Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 19, 2012 04:45 AM by asteranup
Participant
1289 Points
1127 Posts
Nov 17, 2012 05:42 PM|LINK
I have a few tabs that are generated with jquery. Focus is on the first tab.
When the second tab is clicked I want to execute some jquery code to display a map.
How do I make this work?
TIA, Robert
<div id="tabs"> <ul> <li><a href="#tabs-1">Details</a></li> <li><a href="#tabs-2">Map</a></li> </ul> <div id="tabs-1"> <h3></h3> </div> <div id="tabs-2"> <div id="map_canvas" style="width:650px; height:520px;"></div> </div>
Here is the script:
$(" ? ").click(function () { $("#showtrips").delay(1000).dialog(dialogmapinitialize); $("#showtrips").dialog("open"); }); $(function () { $(' ? ').live('hover', function () { $(this).toggleClass('clickable'); }); }); </script>
Contributor
4240 Points
922 Posts
Nov 17, 2012 05:59 PM|LINK
$("#tabs-2").click(function () { $("#showtrips").delay(1000).dialog(dialogmapinitialize); $("#showtrips").dialog("open"); }); $(function () { $('#tabs-2').live('hover', function () { $(this).toggleClass('clickable'); }); }); </script>
All-Star
30184 Points
4906 Posts
Nov 19, 2012 04:45 AM|LINK
Hi,
Try this-
http://jsfiddle.net/asteranup/94mqp/3/
wavemaster
Participant
1289 Points
1127 Posts
how to execute jquery code based on click on a tab
Nov 17, 2012 05:42 PM|LINK
I have a few tabs that are generated with jquery. Focus is on the first tab.
When the second tab is clicked I want to execute some jquery code to display a map.
How do I make this work?
TIA, Robert
<div id="tabs"> <ul> <li><a href="#tabs-1">Details</a></li> <li><a href="#tabs-2">Map</a></li> </ul> <div id="tabs-1"> <h3></h3> </div> <div id="tabs-2"> <div id="map_canvas" style="width:650px; height:520px;"></div> </div>Here is the script:
$(" ? ").click(function () { $("#showtrips").delay(1000).dialog(dialogmapinitialize); $("#showtrips").dialog("open"); }); $(function () { $(' ? ').live('hover', function () { $(this).toggleClass('clickable'); }); }); </script>_Manvel_
Contributor
4240 Points
922 Posts
Re: how to execute jquery code based on click on a tab
Nov 17, 2012 05:59 PM|LINK
$("#tabs-2").click(function () { $("#showtrips").delay(1000).dialog(dialogmapinitialize); $("#showtrips").dialog("open"); }); $(function () { $('#tabs-2').live('hover', function () { $(this).toggleClass('clickable'); }); }); </script>asteranup
All-Star
30184 Points
4906 Posts
Re: how to execute jquery code based on click on a tab
Nov 19, 2012 04:45 AM|LINK
Hi,
Try this-
http://jsfiddle.net/asteranup/94mqp/3/
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog