To try the concept, I am doing a very simple test.
I got a form with some text input shown from the very beginning. When I click on a field, I want to write its ID and add a value to the input text.
$(document).ready(function() {
$('input').focus(function() {
var currentId = $(this).attr('id');
$("#"+currentId).val('blah');
});
});
This works fine with initial fields, but stops working with fields added via ajax calls.
The trick is that users can click on any field, and I don’t know what they click to. My identifiers are as follows:
experience0-CompanyName
experience[n]-CompanyName
(the [n] part is also used to organize fields in a form, because the elements are grouped by experience, learning skills, etc.
how can i achieve this
source
share