[jQuery] Checkbox checked attribute no set when trigger using click()
Hi,
I'm rewriting some old code to use jQuery now, and I can figure out
why this isn't working and would love some help. I used to create a
checkbox DOM element and assign a function object to the onlick
handler:
var theElement = document.createElement( 'input' );
theElement.type = "checkbox";
theElement.onclick = checkCallback;
Then later I want to invoke that handler if some state is true, put
that in using jQuery a while ago:
$(theRow).find(':input[type="checkbox"]').click();
When I did this the onclick handler was called and set up some
presentation based on the checkbox being 'checked'. In the handler
the value of event.target.checked was true. When the handler
finished, the UI presentation was a checked box.
Well, now I'm changing the HTML around so much that I'm rewriting it
with jQuery methods. So now I create the checkbox (and its enclosing
table cell) with an HTML string:
$row.append( $('<td class="'+ className +'" align="middle">'
+'<input type="checkbox" name="iScsiTargetVolume" id="' foo'"/