Note that there are some explanatory texts on larger screens.

plurals
  1. POGet the class element id using jquery
    primarykey
    data
    text
    <p>When I load the page and type this into the console:</p> <pre><code> $("div .maps_popup"); </code></pre> <p>I get the following shown to me:</p> <pre><code> &lt;div class="maps_popup" id="2"&gt; </code></pre> <p>So from there in my code I have the following:</p> <pre><code> $("div .maps_popup").on('click', function () { var store_id = $(this).id; alert(store_id); }); </code></pre> <p>And when I click on the icon in the map - I do not get the alert in the browser for the id. So something isn't right. Can someone adjust my code and let me know what I am doing wrong?</p> <p>Thanks</p> <p><B>UPDATE</B> I've tried all the examples on this thread and none seem to work. The page is at: <a href="http://test.theslickfeed.com/index.php" rel="nofollow">http://test.theslickfeed.com/index.php</a></p> <p>Click on any of the icons on the map and again open developer tools and then go to the console and do:</p> <p>$("div .maps_popup") You will see the div tag there.</p> <p>None of the examples work so far :(</p> <p><B>UPDATED AGAIN</b> This is my present code and it still isn't doing what it should be which is snagging the id of the maps_popup class and passing it to the url for a panel refresh:</p> <pre><code> $("div.maps_popup").click(function(){ var store_id = this.id; var pathname = "ajax=1&amp;store_id="+store_id+"&amp;action=get_nearby_stores&amp;distance="+distance+"&amp;lat="+lat+"&amp;lng="+lng+"&amp;products="+$('#edit-products').val(); $("#pocp_content").load("file1.php?" + pathname); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload