troubleshooting Question

how to do it in javascript ?

Avatar of Rozamunda
Rozamunda asked on
JavaScript
5 Comments1 Solution309 ViewsLast Modified:
I have an ajax request returning :

  success : function(resp) {                   
                    document.getElementById('MyIdSpan').innerHTML = '';      
                          document.getElementById('MyId').innerHTML = 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:checkbox').click( function() {                                    
                          $(this).parent("LABEL").toggleClass('checked', $(this).attr('checked'));
                          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 CERTIFIED SOLUTION
Kim Walker
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros