php - Loading tab by default in jQuery tab script -



php - Loading tab by default in jQuery tab script -

i have jquery tab script gets content php file defined link , parses div element. when user selects tab, turns bold. however, when script loaded up, tab not selected default. question how can load tab , it's contents default , show tab selected current code?

this current jquery code:

function load(url){ $.ajax({ url:url, success:function(message){ $("#content").html(message); } }); } $(document).ready(function(){ $("[id]").click(function(){ type=$(this).attr("id"); url=""+type+".php"; $("[id]").removeclass("selected"); $("#"+type).addclass("selected"); load(url); homecoming false; }); });

this html code:

<ul> <li><a id="tab1" href="javascript:void(null);">tab1</a></li> <li><a id="tab2" href="javascript:void(null);">tab2</a></li> <li><a id="tab3" href="javascript:void(null);">tab3</a></li> </ul>

trigger click event of tab want load: e.g. -

$(document).ready(function(){ $("[id]").click(function(){ type=$(this).attr("id"); url=""+type+".php"; $("[id]").removeclass("selected"); $("#"+type).addclass("selected"); load(url); homecoming false; }); //load default tab $("#tab1").click(); });

php javascript jquery html

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -