We help IT Professionals succeed at work.

how to create jquery object ?

Rozamunda
Rozamunda asked
on
Medium Priority
285 Views
Last Modified: 2012-06-22
I have an input element
<label>	 <input name = 'inp'  value = 'AL'  
		   			type = 'checkbox' onClick='HC(this)'> AL </label> ";

Open in new window


and even handler
 function HC(chk)
 {

    tit  = tit + chk.parentNode.innerText + ', ';

Open in new window


Where I want to get the label content, for some reason it stopped working in IE
it is complaining that chk.parentNode is not an object. I would like to use Jquery
parent() function. but how to create jquery object out of chk ?
Comment
Watch Question

leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
function HC(chk)
 {

    tit  = tit + $(chk).closest("label") + ', ';

Open in new window

Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
my bad...

function HC(chk)
 {

    tit  = tit + $(chk).closest("label").text() + ', ';

Open in new window

Explore More ContentExplore courses, solutions, and other research materials related to this topic.