Вопрос

I'm using this plugin for Wordpress http://wordpress.org/plugins/put/ which adds JQuery tabs to posts using a shortcode. I'll have 8-10 unique tab sets on each page and I need a hyperlink in each Tab 1 to link to it's own Tab 4.

The following code works in Chrome desktop/mobile but in Firefox & IE it opens the url javascript: jQuery('a[href=#tabs-1-4]').click() that says [object Object] on the page.

<a href="javascript: jQuery('a[href=#tabs-1-4]').click()"><span class="icon-shopping-cartsmall"></span> BUY A LICENSE</a>

The plugin already adds unique id's for each tab in a post so having unique id's to link to isn't a problem.

What do I need to use in that hyperlink that will work in all browsers/mobile? I want it to function exactly like it does now in Chrome where no hashtag is added to the url and it just jumps to the 4th tab.

------ EDIT -------

Found this code and it seems to work in IE/FF/Chrome! Does this look ok to you experts?

<div class="buybutton"><a onclick="$('a[href=#tabs-1-4]').click();"><span class="icon-shopping-cartsmall"></span> BUY A LICENSE</a></div>
Это было полезно?

Решение

This updated code seems to work in Chrome/FF/IE:

<div class="buybutton"><a onclick="$('a[href=#tabs-1-4]').click();"><span class="icon-shopping-cartsmall"></span> BUY A LICENSE</a></div>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top