开发者

Obtaining Text Box Value after Chracter has been Typed in jQuery

开发者 https://www.devze.com 2023-02-16 07:46 出处:网络
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() {

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

精彩评论

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