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

c# - Move local mssql database to webhosted MYSQL -

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -