To find form element from the element which triggered event. I use following code. but it seems crazy to me.
Is there a better way doing this?
$("#xx").click(function(event) {
var testValue = $(this).parent().parent().parent().parent().parent().parent().parent().data("test");
});
thank you in advance.
Crazy is right. 😀
$(this).closest('#firstForm')should do this for you.