我正在尝试在jQuery中为单击单选按钮时的漂亮弹出窗口编写代码。我不断收到此错误:
无法读取null的属性“ on”
我在这里做错了什么?
<!-- Remember to include jQuery :) -->
<script type="text/javascript">(function(){var b=this._tly={q:[],mark:function(a,c){b.q.push(["mark",a,c||(new Date).getTime()])},measure:function(a,c,e){b.q.push(["measure",a,c,e||(new Date).getTime()])},done:function(a){b.q.push(["done",a])},cid: "BRQBvTJDR0ZFpRltmSOP6bwZiyY=", xt: "1B658C8BD5E1E64760AEF7935CBF06F51B62C6706E4C534D155413E32B" };b.mark("firstbyte");this.onerror=function(a,c,e){b.measure(["_jserror ",a,"|",c,"|",e].join(""))};var d=this.attachEvent,f=this.addEventListener;var g=function(){b.measure("winload");b.done()};d?d("onload",g):f&&f("load",g,!1);var h=document.createElement("script");h.type="text/javascript";h.async=!0;h.src=("http:"===document.location.protocol? "http:": "https:") + "//d2gfdmu30u15x7.cloudfront.net/1/tly.js";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(h,i);}());</script><script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<!-- jQuery Modal -->
<script type='text/javascript' src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />
<span disabled="disabled"><input id="Button1" type="radio" name="Button1Group" value="radioButton1" disabled="disabled" />
<span disabled="disabled"><input id="Button2" type="radio" name="Button2Group" value="radioButton2" disabled="disabled" />
$(document).ready(function() {
$("#Button1").on('change', function() {
if (document.getElementById("Button2").checked === false) {
$('#ex1').modal({
escapeClose: false,
clickClose: false,
showClose: false
}, 'show');
}
});
});