Hi am attempting to fire off some jQuery on the click event of a div. I am attempting to target the element via jQuery's attribute equals selector, but I have not had any luck so far. I've used this selector several times in the past, but never with a custom attribute. It seems unlikely that a custom attribute would cause an issue with using this method to me, but maybe I'm wrong. Anyway here is the code I am using:
$( "div[data-for='product-description']" ).live("click", function({
alert("test click");
}));
<div class="m-pageEl ui-collapsible" data-for="product-description"><a href="#"><span class="ui-btn-txt">Description</span><span class="caret pull-right"></span></a></div>
I do not receive any console errors, so I'm not sure what the issue could be here, but my alert never fires on click. I have tried using .click and .live("click"... If anyone has a suggestion, it would be greatly appreciated!