I have a UserControl in MVC which may be repeated many times on the page.
Say I had something like the following:
<div>
<a href="#" class="enableTextBox">edit</a>"
<input type="text" class="comments" readonly="readonly" />
</div>
<div>
<a href="#" class="enableTextBox">edit</a>"
<input type="text" class="comments" readonly="readonly" />
</div>
<div>
<a href="#" class="enableTextBox">edit</a>"
<input type="text" class="comments" readonly="readonly" />
</div>
How can I find the class="comments"
element which is in the same div as the class="enableTextBox"
link, in the onclick event of the link?
Is this a sensible way of handling element Id conflicts? Is there a better way? How secure would it be in terms of running in an enterprise app and being certain of data consistency?