asp.net - jQuery click event not working in a jQuery tab page -
i'm using jquery tab in mvc3 solution. problem when insert link in 1 of these tabs, i'm not able control link jquery?!
here code:
the main tab subdivision page:
<div id="tabcontainer"> <ul> <li>@html.actionlink("tab 1", "detailfootertab1", "mycontroller")</li> <li>@html.actionlink("tab 2", "detailfootertab2", "mycontroller")</li> <li>@html.actionlink("tab 3", "detailfootertab3", "mycontroller")</li> </ul>
with script:
$("#tabcontainer").tabs();
in tab3 page have code:
<a href="#" id="buttontest">test</a> <script type="text/jscript"> $("#buttontest").click(function () { alert('i link in tab 3 page'); }); </script>
these jquery tabs works. mean can click on 1 of these , system showing corresponding tab (and hiding other tab content). when click test link, nothing happened! idea?
did put code on $(document).ready ?
$(document).ready(function(){ $("#buttontest").click(function () { alert('i link in tab 3 page'); }); });
or if element added on dom later. can use live event
$("#buttonteest").live('click',funciton(){ alert('i link in tab 3 page'); });
Comments
Post a Comment