WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • jQuery »
  • jQuery dummy question
  • Print
Pages: [1]   Go Down

Author Topic: jQuery dummy question  (Read 6566 times)

Argos

  • Guest
jQuery dummy question
« on: July 06, 2010, 11: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: [Select]
<script type="text/javascript">
$(function() {
$("#tabs1").tabs({
});
});
$(function() {
$("#tabs2").tabs({
});
});
</script>

Can anyone help me out?  :roll:
Logged

Waldschwein

  • Guest
Re: jQuery dummy question
« Reply #1 on: July 07, 2010, 12:32:28 AM »
Hello!

Code: [Select]
<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

  • Guest
Re: jQuery dummy question
« Reply #2 on: July 07, 2010, 12:41:26 AM »
Thanks Michael, I chose to use a class instead of the 2 ID's. Works great!
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: jQuery dummy question
« Reply #3 on: July 07, 2010, 01:34:31 PM »
Quote from: Waldschwein on July 07, 2010, 12:32:28 AM
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
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • jQuery »
  • jQuery dummy question
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2