0

Is there any way that I can get "Enable Recruiters to directly contact me" in Javascript or JQuery when the checkbox checked?

I know I can get the value easily, but how about the text beside that which can be in a lable?

<input type="checkbox" name="rec" id="rec" value="ON"><label for='rec'>Enable Recruiters to directly contact me</label>

Please let me know if you need more clarification!

1 Answer 1

2

You can bind the change event and use the event source object to call next on it to get the label next to checkbox.

Live Demo

$('#rec').change(function(){
   if(this.checked)
    alert($(this).next().text())    
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.