I have my table crated dynamically. Also I created textbox that should disable all other text boxes after user click to input text in one of them. What I'm struggling is to get button created just next to text box which I clicked on. My current code show the button on the same spot. Does not matter which text box I clicked on my button always show up next to the first text box. HTML code:
<tr>
<td>#TimeFormat(StartTime,'hh:mm tt')#</td>
<td>#TimeFormat(EndTime,'hh:mm tt')#</td>
<td><input type="text" name="fname" id="fname">
<input type="button" id="test" name="test" value="Save" onClick="testButton()" style="display: none">
</td>
</tr>
JQuery code:
$(document).ready(function() {
$(":text").keyup(function(e) {
if($(this).val() != '') {
$(":text").not(this).attr('disabled','disabled');
$("#test").show();
} else {
$(":text").removeAttr('disabled');
$("#test").hide();
}
});
});
I'm not sure why button show up only in the first row. My text box function works fine. If I click in one text box all other will be blocked. Only issue is that my button is not created next to the text box that I clicked but first one. If anyone see where is my code breaking please let me know. Thank you.