JQuery input field on change & onload

JQuery input field on change & onload – How to add a jquery eventlistener automatically to all form input fields? A function should be executed at the page initialization (onload) and input field changes.

Code

function calculate() {
   // yourcode
}
$(document).ready(calculate)
$(":input").change( function() {
   console.log("input changed")
   calculate()
});

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Nach oben scrollen