How can I know from which form id a given function is sent? The function is buscar_cidades()
and is present in 2 forms Pessoa Física
and Pessoa Jurídica
.
How to know in jQuery which form (id) the function is being sent to?
<form action="" id="pessoa_fisica">
<select name="estado" onchange="buscar_cidades()">
...
</select>
</form>
<form action="" id="pessoa_juridica">
<select name="estado" onchange="buscar_cidades()">
...
</select>
</form>
Update
Knowing which id is being sent to the function, how to capture the select of this id knowing that the select has class estado
?
var formid = $(e).closest("form").attr("id");
var estado = ??????????