May 24, 2010

use jquery to refresh div tab onclick?

Question by Q7898339

I’m using tabs, but wondering if it’s possible to “refresh” tab content onclick?

Answer by Starx

Yes it is possible, but you dont need onClick event for this I think

use this

<div id="example">
     <ul>
         <li><a href="ajaxpage1.php"><span>Content 1</span></a></li>
         <li><a href="ajaxpage2.php"><span>Content 2</span></a></li>
         <li><a href="ajaxpage3.php"><span>Content 3</span></a></li>
     </ul>
</div>

Notice that: instead of giving the id of the tab’s division, a page link given
so every time you click on the tabs, it updates it

this degrades gracefully – the links, e.g. the content, will still be accessible with JavaScript disabled.

ps: I am assuming that you having a
working tabs

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!