Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 07:25:07 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155534 Posts in 21713 Topics by 7737 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: jQuery dummy question  (Read 753 times)
Argos
WebsiteBaker Org e.V.

Offline Offline

Posts: 2161


WWW
« on: July 06, 2010, 10:12:07 PM »

I have searched and searched the web, but couldn't find an answer. As a non-coder I don't know how to combine these two jquery calls:

Code:
<script type="text/javascript">
$(function() {
$("#tabs1").tabs({
});
});
$(function() {
$("#tabs2").tabs({
});
});
</script>

Can anyone help me out?  rolleyes
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Waldschwein
Guest
« Reply #1 on: July 06, 2010, 11:32:28 PM »

Hello!

Code:
<script type="text/javascript">
$(function() {
$("#tabs*").tabs({
});
});
</script>
That could do it. The other would be setting a "for" loop ( for i=1, i++, ...).
Perhaps the better solution would be using in HTML/CSS a class "tabs" and not an id, then you won't have the problem with the different names - jQuery is more performant with classes then with IDs...

Yours Michael
Logged
Argos
WebsiteBaker Org e.V.

Offline Offline

Posts: 2161


WWW
« Reply #2 on: July 06, 2010, 11:41:26 PM »

Thanks Michael, I chose to use a class instead of the 2 ID's. Works great!
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #3 on: July 07, 2010, 12:34:31 PM »

jQuery is more performant with classes then with IDs...
That's wrong info, Michael.

Quote
Use ID as Selector whenever possible

Selecting DOM elements using the class attribute is simpler than ever using jQuery. Even though it is simple it should be avoided whenever possible as as selecting using ID is much faster

source:
http://www.tripwiremagazine.com/2010/04/24-irresistible-jquery-tips-to-power-up-your-javascript-skills.html


Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!