I have many forms (created by user with an "add" button) every of this forms have an unique ID, but the input inside "Form1" will have the same ID than the input inside "Form2". How can I identify the text inside every input?
I mean, maybe exist something like: form1.getelementbyid(input_value)?
What I need to do is to execute a function to calculate a result for every form, this is why I need to recognize the inputs for every form.
This is the code which I have for execute a function and get the results for one form, it works fine:
function Calcular_Montos()
{
var val = $('#IBC').val();
var porcentaje_riesgos = $('[name=porcentaje_riesgos]:checked').val();
var exento_salud = $('[name=exento_salud]:checked').val();
$.ajax({
url: 'costo_empleado.php',
type: 'POST',
data: {"IBC": val, "porcentaje_riesgos": porcentaje_riesgos, "exento_salud": exento_salud},
success: function (response)
{
$('#resultado').html(response);
}
});
}
But as you can see, those #IBC, #porcentaje_riesgos, #exento_salud are IDs which are going to be common for Form1 and Form2