Rozamunda
asked on
how to do it in javascript ?
I have an ajax request returning :
success : function(resp) {
document.getElementById('M yIdSpan'). innerHTML = '';
document.getElementById('M yId').inne rHTML = resp;
now inside resp I have checkoboxes, i want to assing onclick event to all of them
In Jquery it would be like this:
$('MyId).find('INPUT:check box').clic k( function() {
$(this).parent("LABEL").to ggleClass( 'checked', $(this).attr('checked'));
updatetext('MyID);
});
The response I am getting is something like this:
success : function(resp) {
document.getElementById('M
document.getElementById('M
now inside resp I have checkoboxes, i want to assing onclick event to all of them
In Jquery it would be like this:
$('MyId).find('INPUT:check
$(this).parent("LABEL").to
updatetext('MyID);
});
The response I am getting is something like this:
<label class= "ui-state "> <input name = "Ps[]" value = "1"
type = "checkbox"> 1 </label> <label class= "ui-state "> <input name = "Ps[]" value = "4"
type = "checkbox"> 4 </label> <label class= "ui-state "> <input name = "Ps[]" value = "2"
type = "checkbox"> 2 e </label> <label class= "ui "> <input name = "Ps[]" value = "3"
type = "checkbox"> 3 </labell>
ASKER
yes, I want to replace jquery with javascript
ASKER
so how to select and attach an event to all of the checkboxes which are just attached to DOM ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, thanks got it, and from any div it would be like above
myid = document.getElementById("m yID");
myidinputs = myid.getElementsByTagName( "input")
myid = document.getElementById("m
myidinputs = myid.getElementsByTagName(
Open in new window