I have two forms almost identical, one for physical and another for legal entity and these forms are hidden and appear as the result of a jQuery().change
that determines if it is the form for the individual or legal entity to be used.
In both forms I am calling ids
identical where in pfisica
has #estado
and #cidade
and pjuridica
also, I need the same information.
A jQuery (). change function in select #estado
calls the buscar_cidades()
function that captures the selected state id and searches the database with Ajax.
As the 2 forms load on the same page and appear according to the choice between PF
or PJ
, how do I solve this problem of ids
knowing that duplicate ids conflict in jQuery
?
One solution would be to create two pages but did not want to do that. Another solution would be to change the ids and duplicate the function get_cities and change the name of the function that would call the ids of the other form, but I think it's more POG
than something else.
How to solve?