Reputation: 23
Just having a mess around with jQuery. Very new to this. Have had a search for my issue with no luck.
I currently have 2 columns of text boxes, ID's being code + count + & description + count +. On each of the code boxes i have autocomplete which then adds the label of that value to the description box.
example: https://i.sstatic.net/P26N8.png
How do i get the id of the text box so i can use that number to send the description to that text box.
would like something like:
var id = currenttextboxid(number only)
$( "#description" + id + "" ).val(ui.item.label);
Appreciate your help people :)
Sorry if i have worded that terribly.
Upvotes: 0
Views: 109
Reputation: 25527
Try like this
html
<input type="text" id="descroption1"/>
script
$("input").click(function(){
alert((this.id).replace("descroption",""));
});
$("input").each(function(){
alert((this.id).replace("descroption",""));
});
Upvotes: 1