I want to execute a function every time the value of a specific input box changes. It almost works with $(\'input\').keyup(function)
, but nothing happe
Try this:
Basically, just account for each event:
Html:
<input id = "textbox" type = "text">
Jquery:
$("#textbox").keyup(function() {
alert($(this).val());
});
$("#textbox").change(function() {
alert($(this).val());
});
$("#myTextBox").on("change paste keyup select", function() {
alert($(this).val());
});
select for browser suggestion
just remenber that 'on' is recomended over the 'bind' function, so always try to use a event listener like this:
$("#myTextBox").on("change paste keyup", function() {
alert($(this).val());
});
you can also use textbox events -
<input id="txt1" type="text" onchange="SetDefault($(this).val());" onkeyup="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();">
function SetDefault(Text){
alert(Text);
}
Try This
Try this:
$("input").bind({
paste : function(){
$('#eventresult').text('paste behaviour detected!');
}
})
Use this: https://github.com/gilamran/JQuery-Plugin-AnyChange
It handles all the ways to change the input, including content menu (Using the mouse)