3
I have a field textarea
and a "send" button just below, and added an event onfocus
and onblur
in that field. The onfocus
increases the height of the field, and the onblur
back to normal. I also added an event onclick
on the "send" button to validate the field textarea
. However, the event onblur
is "undoing" on the first click of the event onclick
from the "send" button. The code is this:
HTML:
<textarea id="meutexto"></textarea>
<br>
<div id="botao">
<input type="button" value="enviar" />
</div>
Script:
$("#meutexto")
.on('focus',function(){
$(this).css('height','60px');
})
.on('blur',function(){
$(this).css('height','30px');
});
$("#botao input").on('click',function(){
$("#botao").html('Enviando texto...');
});
It turns out that by clicking the "send" button 1 time, nothing happens. Only the second click that the DIV
"boot" is changed to "Enviando texto..."
.
In case I pay the lines:
.on('blur',function(){
$(this).css('height','30px');
});
The script works. However I would not like to remove the onblur
. I wonder what’s wrong?
Perfect! Thank you!
– Sam
@Davidfernandes great that worked!
– Sergio