开发者

Obtaining Text Box Value after Chracter has been Typed in jQuery

What is the best way to get the value in a text box after character has been typed in jQuery? I always seem to be missing out o开发者_Python百科n the last character.


$('textbox').keyup(function() {
  var value = $(this).val();
});


YOu can use the bind function:

http://api.jquery.com/bind/

$('#textBoxId').bind('keyup keypress', function() { 
      //Do you stuff
  });


$("#textboxId").keyup(function(){
  $(this).val()
});


Try catching both change and keyup event

$("#test").bind("onkeyup change",function()
    {dosomething($(this).val())});

demo http://jsfiddle.net/RnPcf/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜