我是JS的新手jQuery,而且我正在努力制作一个使用它们的字幕播放器.不幸的是,我陷入了很早的阶段.
当我试图HTML通过.js文件选择一些元素时,它表现得无法找到我要求的元素,并且没有任何反应.如果我尝试提醒元素的值或HTML,它会发出警报undefined.
所以这是代码:
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="jquery-2.1.3.min.js"></script>
<script src="script.js"></script>
<style type="text/css">
body{
margin: 0px;
padding: 0px;
}
#wrapper{
width: 150px;
text-align: center;
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#75bdd1), color-stop(14%,#75bdd1), color-stop(100%,#2294b3));
padding: 10px 2px;
}
h3{
font-family: Arial, Helvetica, sans-serif;
}
img{
width: 50px;
margin: 0 auto;
}
input{
display: none;
}
</style>
</head>
<body>
<div id="wrapper">
<h3>Select subtitles file</h3>
<img src="browse.png" alt="browse">
</div>
<input type="file" accept=".srt" id="file"> …Run Code Online (Sandbox Code Playgroud)