Tuesday, September 10, 2013

Set JQuery HTML javascript Checkbox working but not showing as checked

Set JQuery HTML javascript Checkbox working but not showing as checked

All im trying to do is check if a checkbox is checked, if so, uncheck it.
The checkbox is being set properly but not showing as checked. I have
check this my putting a checkbox outside the <li> and it works fine
Here is my current HTML:
<input onclick="selectAll()" type="button" id="checkAll" value="Check All" />
<li>
<a href="#" style="padding-top: 0px; padding-bottom: 0px;
padding-right: 0px; padding-left: 0px;">
<label style="border-top-width: 0px; margin-top: 0px;
border-bottom-width: 0px; margin-bottom: 0px;
border-left-width: 0px; border-right-width: 0px;"
data-corners="false">
<fieldset data-role="controlgroup">
<input type="checkbox" name="checkboxProd"
id="checkboxProd2" data-theme="c"
checked="checked" />
<label for="checkboxProd2"
style="border-top-width: 0px; margin-top: 0px;
border-bottom-width: 0px; margin-bottom: 0px;
border-left-width: 0px; border-right-width:
0px;">
<h3>Black Denim</h3>
</label>
<table id="OrderDetailsTable2" border="0"
style="background-color: transparent;
border-color: transparent; color: transparent;
width: 250px; font-size: small; padding: 0;
padding-left: 3em;">
</table>
</fieldset>
</label>
</a>
</li>
and my Javascript/Jquery:
function selectAll()
{
if ($('#checkboxProd2').prop('checked'))
{
alert("checked");
$('#checkboxProd2').prop('checked', false);
}
}

No comments:

Post a Comment