I'm trying to select textareas based on the value in them, I tried doing this:
alert( $('textarea[value="Type"]').length );
But I get zero.
Here's my textarea:
<textarea id="Title" name="title" rows="5" cols="29" class="textentry_verdana12pxItalic">Type</textarea>
Can I do this?
value is not an attribute of that textarea. That textarea's HTML attributes are id, name, rows, cols, and class. Try this instead:
$('textarea').filter(function ()
{
return $(this).val() === 'Type';
}).length
.filter() API docs
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