Let me preface this question by saying there may be a completely different solution than my title so let me tell you what I am after entirely.
Basically I have a series of menu links. The href in all the links are storing jQuery functions, not URL’s (to control turn.js book script). So one of the href‘s may look like so:
<li id="menu-item-68" class="home menu-item menu-item-type-custom menu-item-object-custom menu-item-68">
<a href="$('#primary').turn(‘page’,1);"></a>
</li>
The request is simple…on click() of a menu item i need to execute the contents of the href. My first thought was to run through each link and store a temp string of the href and then use eval() but that looks to be a bad option from what I read.
So, how can I execute the contents of my href quickly and safely?
How about use the onclick event?
Alternately, since you’re using JQuery, you could
.bind()the event:Alternately, since you only have access to the
hrefattribute, you COULD do this, which is the easy way out: