This is a typical entry of many on a page:
<div class="link_entry">
<div class="link_actions left">
<span class="LibraryItemDelete">
<img src="images/ajax-urls/delete_icon.png" title="Delete this link" alt="Delete this link">
</span>
<span class="LibraryItemEdit">
<img src="images/ajax-urls/edit_icon.png" title="Edit this link" alt="Edit this link">
</span>
</div><!-- /link_actions -->
<div class="link right">
<input type="hidden" value="92" name="id"> <--want to find and assign that value
<a href="http://www.somewhere.com">somewhere.com</a>
</div><!-- link -->
</div><!-- /link_entry -->
This is the start of a jQuery function for an ajax call:
$(document).on('click', '.LibraryItemEdit', function() {
var url_id = $(this).find('input[name="id"]').val();
}
I want a way to find and assign to a variable the value of the hidden input field that is below the span LibraryItemEdit.
I am using hidden input fields to store the database table id for each link. Is there a better method? The id's are only for the purposes of ajax calls.