Solved

how to create jquery object ?

Posted on 2012-03-12
2
254 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 ?
0
Comment
Question by:Rozamunda
  • 2
2 Comments
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
function HC(chk)
 {

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

Open in new window

0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
my bad...

function HC(chk)
 {

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

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now