Hi All,
I'm a new comer to this forums and also jQuery.
There is this problem that I encountered while practicing with jQuery.
jQuery Script
$(document).ready(function(){
$(#formDiv :button).click(
function(){
var id = $(#userId).val()
var name = $(#name).val()
addRow(id, name)
}
);
var addRow = function(id, name){
$(tr +
td+id+/td +
td+name+/td +
td align=center +
input type=checkbox +
/td).insertAfter($(#atable tbody))
};
$(#atable :checkbox).attr(checked, false);
$(#atable thead :checkbox).click(
function(){
alert(checkbox in thead)
}
);
$(#atable tbody :checkbox).click(
function(){
alert(checkbox in tbody)
}
);
});//end ready
HTML
html
head
titlejQuery Example/title
script type=text/javascript src=lib\jquery
\jquery-1.3.2.min.js/script
script type=text/javascript src=script.js/script
/head
body
div id=formDiv
User ID: input type=text id=userIdbr/
Name: input type=text id=namebr/
input type=button value=Add Row
/divbr/br/
div
table id=atable width=500px border=1 cellspacing=1
thead
thUser ID/th
thName/th
th
input type=checkbox
/th
/thead
tbody
/tbody
/table
/div
/body
/html
The problem I'm having is, the alert does not fire whenever the
checkboxes in the tbody are clicked.
Hopefully I can find some help here.
Thanks in advance.
Alvin