I am trying to do this:
$('input:text','textarea').focus(function () {
$(this).removeClass('wrong');
if (this.value == this.defaultValue){
$(this).val('');
}
But $('input:text','textarea')
wont work as a selector. What am I doing wrong?
The select() event is applied to an element using jQuery when the user makes a text selection inside an element or on focus the element. This event is limited to some fields. Syntax: $("selected element").
Description: Selects all input, textarea, select and button elements.
jQuery :contains() SelectorThe :contains() selector selects elements containing the specified string. The string can be contained directly in the element as text, or in a child element. This is mostly used together with another selector to select the elements containing the text in a group (like in the example above).
Try $('input:text, textarea')
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