What does the keyup() at the end of it mean?
$("input").keyup(function () {
var value = $(this).val();
$("p").text(value);
}).keyup();
What does the keyup() at the end of it mean?
$("input").keyup(function () {
var value = $(this).val();
$("p").text(value);
}).keyup();
Thanks @nnnnnn Sir.
The code bind a keyup event to all inputs already belong to DOM and immediately trigger it for those inputs.
Now,
$("input").keyup(function () {
var value = $(this).val();
$("p").text(value);
});
above code bind the keyup event to input and last .keyup() makes an initial trigger to keyup.
You can rewrite above code also as following:
$("input").keyup(function () {
var value = $(this).val();
$("p").text(value);
})
$('input').keyup(); // or $('input').trigger('keyup');
NO, It triggers just one time at page load. See here