0
私はチュートリアルを試してみましたが、まだ動作しませんでした、何が問題なのですか?親ページからiframeの値を取得できません
親ページのスクリプト:
<!DOCTYPE html>
<html>
<head>
<title>Parent</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-3.1.0.slim.js"></script>
<script>
$(function() {
var money = 20000;
$("#iframe1").contents().find("#nominal").on("change keyup", function() {
var input = $(this);
// remove possible existing message
if(input.next().is("form"))
input.next().remove();
// show message
if(input.val() > money)
alert('Hello');
});
});
</script>
</head>
<body>
<iframe id="iframe1" src="iframe.html">
</iframe>
</body>
</html>
インラインフレームスクリプト:
<!DOCTYPE html>
<html>
<head>
<title>Iframe</title>
</head>
<body>
<input type="text" id="nominal" value="" />
</body>
</html>
おかげで進め、間違っていたものを私に教えてください。先加载iframe
が表示されない、警告を動作することはできません。ここではコンソール 'jQuery.Deferred exception:$(...)からのエラーログがあります:loadは関数ではありません@http://localhost/iframe/parent.html:12:17 resolve/ mightThrow @ http:// code.jquery.com/jquery-3.1.0.slim.js:3508:21 resolve/ process <@http://code.jquery.com/jquery-3.1.0.slim.js:3576:12 は未定義で、この 'TypeError:$(...)。loadは関数ではありません。 ' –
jqueryのバージョンを変更し、バージョン2.2では3を使用しません。 –
同じBroは動作しません。' ReferenceError:$ is not defined'エラーコンソールにログイン –