Jquery 未在 HTML 形式中定义
Jquery is not defined in HTML form
我一直收到这个错误。为了解决这个问题,我尝试在我的脚本之前加载 Jquery 库,当然反过来也是如此。
我的 html 目前是这样的:
<html>
<head>
</head>
<body>
<div id="pageContent" data-step='init' class="ui-widget">
<div class="form-group">
<label for="search">Handelsnaam</label>
<input id="search" type="text" autocomplete="off" name="query" placeholder="Zoek op handelsnaam" class="form-control">
<small id="searchHelp" class="form-text text-muted">Vul uw handelsnaam in...</small>
</div>
<div class="form-group">
<label for="handelsnaam">Handelsnaam</label>
<input type="text" class="form-control" id="handelsnaam" name="handelsnaam" placeholder="Handelsnaam">
<label for="straat">Straat</label>
<input type="text" class="form-control" id="straat" placeholder="Straat">
<label for="huisnummer">Huisnummer</label>
<input type="text" class="form-control" id="huisnummer" placeholder="Huisnummer">
<label for="huisnummertoevoeging">Huisnummertoevoeging</label>
<input type="text" class="form-control" id="huisnummertoevoeging" placeholder="Huisnummertoevoeging">
<label for="postcode">Postcode</label>
<input type="text" class="form-control" id="postcode" placeholder="Postcode">
<label for="plaats">Plaats</label>
<input type="text" class="form-control" id="plaats" placeholder="Plaats">
<label for="achternaam">Achternaam</label>
<input type="text" class="form-control" id="achternaam" placeholder="Achternaam">
<label for="opmerking">Opmerking</label>
<input type="text" class="form-control" id="opmerking" placeholder="Opmerking">
<input id="btntest" type="button" value="Submit" onclick="window.location.href = 'https://jewebsite.com/bedank-pagina?companyName=' + encodeURIComponent(document.getElementById('handelsnaam').value) + '&CPLastname=' + encodeURIComponent(document.getElementById('achternaam').value) + '&EXTRAOPMERKING=' + encodeURIComponent(document.getElementById('opmerking').value)" />
</div>
</div>
<script src="https://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script>
<script src="js/script.js"></script>
</body>
</html>
我的 script.js 文件开头如下:
jQuery(document).ready(function($) {
我得到的确切错误是:
jquery-ui.min.js:17 Uncaught ReferenceError: jQuery is not defined
您需要包含 jQuery 本身:
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script>
<script src="js/script.js"></script>
我一直收到这个错误。为了解决这个问题,我尝试在我的脚本之前加载 Jquery 库,当然反过来也是如此。
我的 html 目前是这样的:
<html>
<head>
</head>
<body>
<div id="pageContent" data-step='init' class="ui-widget">
<div class="form-group">
<label for="search">Handelsnaam</label>
<input id="search" type="text" autocomplete="off" name="query" placeholder="Zoek op handelsnaam" class="form-control">
<small id="searchHelp" class="form-text text-muted">Vul uw handelsnaam in...</small>
</div>
<div class="form-group">
<label for="handelsnaam">Handelsnaam</label>
<input type="text" class="form-control" id="handelsnaam" name="handelsnaam" placeholder="Handelsnaam">
<label for="straat">Straat</label>
<input type="text" class="form-control" id="straat" placeholder="Straat">
<label for="huisnummer">Huisnummer</label>
<input type="text" class="form-control" id="huisnummer" placeholder="Huisnummer">
<label for="huisnummertoevoeging">Huisnummertoevoeging</label>
<input type="text" class="form-control" id="huisnummertoevoeging" placeholder="Huisnummertoevoeging">
<label for="postcode">Postcode</label>
<input type="text" class="form-control" id="postcode" placeholder="Postcode">
<label for="plaats">Plaats</label>
<input type="text" class="form-control" id="plaats" placeholder="Plaats">
<label for="achternaam">Achternaam</label>
<input type="text" class="form-control" id="achternaam" placeholder="Achternaam">
<label for="opmerking">Opmerking</label>
<input type="text" class="form-control" id="opmerking" placeholder="Opmerking">
<input id="btntest" type="button" value="Submit" onclick="window.location.href = 'https://jewebsite.com/bedank-pagina?companyName=' + encodeURIComponent(document.getElementById('handelsnaam').value) + '&CPLastname=' + encodeURIComponent(document.getElementById('achternaam').value) + '&EXTRAOPMERKING=' + encodeURIComponent(document.getElementById('opmerking').value)" />
</div>
</div>
<script src="https://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script>
<script src="js/script.js"></script>
</body>
</html>
我的 script.js 文件开头如下:
jQuery(document).ready(function($) {
我得到的确切错误是:
jquery-ui.min.js:17 Uncaught ReferenceError: jQuery is not defined
您需要包含 jQuery 本身:
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script>
<script src="js/script.js"></script>