In my checkboxes, i am using select the element using values.. for that (sample) i made like this..
<form>
<input type="checkbox" value="one 234" />
</form>
function doit(){
var x = "one 234"
$(':checkbox[value='+x+']')
.css({border:"1px solid green"})
}
doit();
But is doesn't work.. in case if i remove the space inbetween the value of "one 234" - it works. how to handle this kind of situation..?
here is the jsfiddle
Use quotes :
$(':checkbox[value="'+x+'"]')
Or filter, which I personally find cleaner and with which you don't have to worry about any character escaping :
$(':checkbox').filter(function(){ return this.value===x })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With