Reputation: 880
I can find a way to get the id = "DropDownListA". But I have to get the id-value by using this
Somehow $(this).closest('input').attr('id')
is not working
<td align="right">
<div class="farvorit_field" id="DivDropDownListA">
<input type="text" id="DropDownListA" name="customerGroup" value="" size="35">
<a href="#" title='See farvorits customers.'>
<img onClick="alert($(this).parent('a').siblings(':text').attr('id'));" src="../img/info.gif" border="0">
</a>
</div>
</td>
Upvotes: 0
Views: 886
Reputation: 12569
If it's an ID it is supposed to be the only one on the page, so why to make things complex and avoid the simplest $('#DropDownListA').attr('id')
?
If you absolutely have to use word this
then use @ShankarSangoli's solution.
Upvotes: 0
Reputation: 69905
Use this.
$(this).parent().prev().attr('id')
.parent()
will give anchor element and then calling .prev()
on it will give the input
element.
Upvotes: 4