This is my code:
$(document).ready(function() {
$( "#kartyaazonosito" ).on( "focusout", function() {
console.log( $( this ).val() ); // I need the actual input value (from the actual line)
});
$( "#biztonsagikod" ).on( "focusout", function() {
console.log( $( this ).val() );// I need the actual input value (from the actual line)
});
});
1."line":
<input placeholder=" " class="o-input__field" type="text" name="cards[0].code" id="biztonsagikod" />
2."line":
<input placeholder=" " class="o-input__field" type="text" name="cards[1].code" id="biztonsagikod" />
The users can be add more and more "lines". The on focusout works only for the 1. "line". How can I solve that, the focusout works the 2."line", and 3. line, etc..
<input class="o-input__field biztonsagikod"...then$(".biztonsagikod").on(...- also assumes they aren't added after your jquery runs (which doesn't appear to be the case as it "works for line 1")