i’ve looked at similar examples at stackoverflow and i think i got the code correctly but it doesn’t work.
- my TD’s are generated by grid object on a fly
-
i’m trying to get (and eventually change) value of the fist empty input that is positioned inside
<td col="isrc">:$("#get_isrc").click(function(){ $.ajax({ url: 'isrc.php', success: function(data){ $("#new_isrc").val(data); $("#get_isrc").val('Apply'); $("#get_isrc").addClass('apply'); } }).error(function(){ alert('Error'); }); }); $(".apply").click(function(){ var s = $("td[col=ISRC] input").val(); alert(s); });
html – static:
<h3>Generate next ISRC</h3>
<input id="new_isrc" type="text" />
<input id="get_isrc" type="button" value="Get next ISRC" />
html generated by jquery:
<tr id="3"><td col="ISRC" style="width: 101px; " class="editableCell"><input class="editableInput " type="text"></td></tr>
<tr id="1"><td col="ISRC" style="width: 101px; " class="editableCell"><input class="editableInput " type="text"></td></tr>
<tr id="2"><td col="ISRC" style="width: 101px; " class="editableCell"><input class="editableInput " type="text"></td></tr>
tr’s 1 and 2 have ISRC values from database
tr 3 – is newly added and i want generated isrc applied to it, but at the moment my code just need to alert me of a new value – it does work…
have you tried using live instead as its generated after document.ready