admin 管理员组

文章数量: 1086019

Is it possible upon page entry to modify this code to uncheck check box id LOTL even if the page is cached?

<script type="text/javascript">

function formReset()
{
       document.getElementById("LOTL").reset();
}
</script>

Is it possible upon page entry to modify this code to uncheck check box id LOTL even if the page is cached?

<script type="text/javascript">

function formReset()
{
       document.getElementById("LOTL").reset();
}
</script>
Share Improve this question edited Oct 4, 2012 at 17:22 Ram 145k16 gold badges172 silver badges200 bronze badges asked Oct 4, 2012 at 17:15 Rocco The TacoRocco The Taco 3,79714 gold badges50 silver badges80 bronze badges 0
Add a ment  | 

5 Answers 5

Reset to default 14

You can use prop method:

$(document).ready(function(){
   $('#LOTL').prop('checked', false);
   //  document.getElementById("LOTL").checked = false
})

This should do the trick:

$(document).ready(function()
{
    $('#LOTL').attr('checked', false);
});

Is the LOTL element the checkbox or the form?

If it is the checkbox you might try this:

$( '#LOTL' ).removeAttr( 'checked' );
function formReset(){
       document.getElementById("LOTL").checked = false;
}

Try this to uncheck

$(function() {   
    $('#LOTL').prop('checked', false);
});

本文标签: javascriptUncheck checkbox with jqueryStack Overflow