Q:

How to pass data-href in  to jquery script?

I want to pop-up a modal window based on a jquery script at http://communitychessclub.com/js/jquery.popupWindow.js
My test page is at http://communitychessclub.com/games_new.php
I am using php to generate a table and I have data-href to trigger the entire table row (tuple) to be clickable to load the game. I have the latest jquery loaded and:
<script src="js/jquery.popupWindow.js"></script>
<script>$('.example').popupWindow({centerScreen:1});</script>

But the pop-up window is blank, based on this:
<tr class="example" data-href="games/game1302.php">

How can I fix this line:
<script>$('.example').popupWindow({centerScreen:1});</script>

so that it picks up the url specified as data-href of the <tr> ?

A:

$('.example').each(function(){
   $(this).popupWindow({centerScreen:1, windowURL: $(this).data("href")});
});

EDIT. Put it in a loop, so $(this) is valid. Also, I've noticed you've included the full URL in your data-href, so no need to include the window.location.hostname now.

