1
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'));
});
});
When changing the value of a given field I want to give an Alert with the name of the attribute, however, I wanted to do this without having to inform the tag of the selector, that is, instead of informing the input I want it to be obtained automatically based on the element I am currently changing. How do I do this?