View Single Post
Old 02-22-2013, 09:38 AM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,532
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by njfail View Post
Out of curiousity, how would I add in things using JS?
Suppose I wanted to change the "tab4" text to something else?
To do that with ordinary JavaScript (without JQuery) you could use:

Code:
li = document.getElementsByClassName('ui-state-default');
len = li.length;
for (i = 0;i < len; i++) {
   if (li[i].firstChild.href == '#tabs-4') {
      li[i].firstChild.innerHTML = ';replacement text';
   }
}
Note that assumes that all the <li> tags have an <a> tag as the first tag inside them so if some of them don't you'd need to add extra code to find the <a> tags. Also if you want it to work on really old browsers you'd need to add code to define getElementsByClassName.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote