Jquery selector for textarea and input fields?
Hi,
I have a function targetted to input fields with class="replacetext" and type="text" $('input.replacetext[type=text]')
How can I make this same function work also for textareas with class="replacetext"?
I have tried:
$('textarea ,input.replacetext[type=text]')
$('textarea.replacetext ,input.replacetext[type=text]')
these does not work...
Heres my code:
- $(document).ready(function(){
- $('input.replacetext[type=text]').live('focus',function(){
- if (this.alt == '') {
- this.alt = this.value;
- this.value = '';
- } else if (this.value == this.alt) {
- this.value = '';
- }
- });
- $('input.replacetext[type=text]').live('blur',function(){
- if (this.value == '') {
- this.value = this.alt;
- }
- });
- });