我想检查复选框时调用html页面。我尝试了以下jQuery代码,但它不起作用。我犯了什么错误?如何使用jQuery调用复选框更改的html页面?
<script type="text/javascript">
$('#my_checkbox').change(function() {
alert('Handler for .change() called.');
$.get("equation_section.html");
});
</script>
这是我的复选框:
<input class="checkbox" type="checkbox" name="my_checkbox" id="my_checkbox"/>
编辑
$('#my_checkbox').change(function() {
if ($('#my_checkbox').attr("checked") == true) {
alert('Handler for .change() called.');
$('#my_checkbox').addClass('jQlightbox');
$.get('equation_section.html', function(data) {
$('.equation_section').html(data);
});
}
});
这是我编辑的代码。现在我收到警报框。该页面也被加载到div中。如果我只想将div内容显示在模式窗口上而不是之前的页面内容怎么办?有人建议我。
“被叫”是什么意思? – sdleihssirhc 2011-04-01 05:38:55
我想要加载其他页面,即方程section.html。 – Angeline 2011-04-01 05:41:12