When one of the divs inside \'uploadChoice\' is clicked, how can I ascertain which one is clicked? Can I return an \'eq\' value somehow?
You can get the contents of the div with
$("#uploadChoice div").click(function(){
var choice = $(this).html;
}
And then just do a switch statement or some nested ifs.
Personally though, I'd add an ID to each of the divs and just check the ID of the clicked element.
You can add selectors as well, and pass "$(this)" as argument:
$(document).on('click', 'button.testbutton', function () {
var index = $('div.example > div.xyz').find('button.testbutton').index($(this));
});
$('#uploadChoice div').click(function(event) {
var index = $(this).index();
});
An easier alternative that does not require duplicating a selector is the following
$('#uploadChoice div').click(function(event) {
var index = $(this).prevAll().length;
});