javascript - Showing selected tabs differently with JQuery ajax tabs -


i had tabs preloaded content this:

$(function () {      $('div.tabs ul.tabnavigation a').click(function () {         $('div.tabs ul.tabnavigation a').removeclass('selected');         $(this).addclass('selected');         return false;     }).filter(':first').click(); }); 

this added class="selected" links , css made selected tab different

<div class="tabs">      <ul class="tabnavigation">          <li><a href="#content1">c1</a></li>          <li><a href="#content2">c2</a></li>          <li><a href="#content3">c3</a></li>     </ul>      <div id="content1">           content 1     </div>      <div id="content2">          content 2      </div>       <div id="content3">          content 3       </div> 

now i`m trying ajax work. it's working i'm having troube getting class="selected" links.

the js function ajax looks this:

$(function() {     $("#tabs").tabs({         ajaxoptions: {             error: function(xhr, status, index, anchor) {                 $(anchor.hash).html("there problem");             }         }     }); }); 

how can extend gives clicked link class "selected"? similar preloaded content version.

$(function() {       $("#tabs").tabs({         ajaxoptions: {             error: function(xhr, status, index, anchor) {                 $(anchor.hash).html("laadimisel ilmnes viga");             }         }     });     $('#tabs a').click(function(){         if($(this).hasclass('selected')){ return false; }          $('#tabs a.selected').removeclass('selected');         $(this).addclass('selected');                return false;     }); }); 

this worked.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -