effects - how to highlight textbox using jquery -
suppose have 2 textboxes i.e textbox1 & textbox2. if type on textbox1 ,then highlight should happen on textbox2.
i tried on keyup event not highlighting
$("#textbox1").keyup(function(){ $("#textbox2").effect("highlight"); ...`
how solve issue?
the highlight effect in jquery ui not intended utilize animating text color (it's background color). think accomplish want, can animate color property directly, animate color, of course of study still need include jquery ui in project. here code can try:
var text2 = $('#textbox2'); $("#textbox1").keyup(function(e){ var currentcolor = text2.finish().css('color'); text2.animate({color:'yellow'}, 50) .animate({color:currentcolor}, 100); });
note currentcolor
have utilize finish()
forcefulness animates finish before getting color using .css()
method. otherwise currentcolor
may color animated. note finish()
method supported version 1.9
. if need utilize jquery lower version (such 1.8), think should initialize currentcolor
outside (and once) onkeyup
handler. that's way each time want alter color of #textbox2
, have update currentcolor
, although think it's not mutual alter color of textbox using script.
jquery effects
No comments:
Post a Comment