User121212 User121212 - 7 months ago 42
jQuery Question

how to get checkbox text in jquery?

<input type="Checkbox" value="1">Option1</input>

How to get text value ?

I need to get option1 text .


Your markup is invalid, input tag doesn't have a closing tag, it's a self close tag, so what you are doing is completely WRONG.

This is the valid way to go for

<input type="checkbox" value="1" />

Side Note : Ignore using uppercase, though it won't mess up your document but it's a good practice to ignore using uppercase.

Lastly to get the text of the value, you can use .attr() method

$('input[type="checkbox"]').on('click', function() {