I have an ajax search that returns values like this:
<a id="searchmykad" href="#" onclick="updatemykad(123123);return false;">Person a</a>
<a id="searchmykad" href="#" onclick="updatemykad(1231236);return false;">Person b</a>
And the javascript function looks like this:
<script>
function updatemykad(mykad) {
$('#searchmykad').click(function(){
$('#asd').val(mykad);
}
)}
</script>
Its updating this textbox:
<input type="text" id="asd" name="asd" value="" class="form-control" autocomplete="off" placeholder="Search Name..." class="input-block-level" placeholder="Search Mykad..." maxlength="12" style="width:100%; " />
Now for all extensive purposes this works. I can select the first result and the value will go into the textbox, however cause all the id's are the same. I can only do it with one. (At least that is what I am thinking).
Can anyone help me get this so all the values will go into the textbox on click.
Best regards Johan Fourie
idattribute on a page.