google analytics - jQuery select element that doesn't have ID or Class -
I want to know for my Google Analytics tracking when someone clicks on the following section of HTML;
& lt; Div style = "..." & gt; Square? & Lt; / Div & gt; Since there is no .class or #id in it, I do not know how to select this item. Can not even be added since it is generated by javascript from an external source. Otherwise it will just happen;
$ j ('# uniqueId'). If there is a change in the content ('click', function () {
But if you know the position of div on the page, then you can use something like this:
$ ('# container div'). Eq (n) .on ('click', function () {// your code here}); Where # container is the page container and the n zeros index space of that div That you want to target (relative to other divs in the container). If there is no container, then you try And can:
$ ( 'body'). ( 'Div'). Eq (n) .on ( 'click', function) {// Your code here});
Comments
Post a Comment