I want to redirect to another page when a checkbox is clicked.
<script type="text/javascript"><!--
$(document).ready(function(){
jQuery(".cbno").click(function(e){
e.preventDefault();
alert('test');
alert(this.val());
// window.location = this.val();
});
});
//-->
</script>
<input type="checkbox" class="cbno" name="content" value="/map/?filter=all" />
Pretty simple - but I cannot figure out why the second alert does not produce any output?
Internet Explorer says: "The object does not support the method val".
It works if I use this.getAttribute('value') - why does it not work with the jquery val()?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…