I have the following form in html:
<form>First name:
<br>
<input type="text" name="nome">
<br>Last name:
<br>
<input type="text" name="sobrenome">
</form>
And the jQuery code: $ (document) .ready (function () {
$('input').change(function()
{
alert($(this).attr('name'));
});
});
By changing the value of a given field I want to give an alert with the name of the attribute, but I wanted to do this without having to enter the tag of the selector, ie instead of informing the input I want it to be retrieved automatically based on the element I'm currently changing. How do I do this?