开发者

dynamically assign click event for anchor tag in asp.net

hey guys, recently i was working on an application where i was having large string and need to be divided in chuck of string, and should be kept in a div, just the purpose was giving pagination to the large string, so i wrote code to split the whole string into multiple chunks and added the chunk of string in a div created at runtime, and also disabled all the other div's except the first, and also given page numbers in the footer for changing pages, but now my issue is i am using anchor tags using HTMLAnchor from code behind, now whenever user clicks on any page that div should be set to display and other all should get hide开发者_运维百科, i am not getting how should i do this from code behind, i have done everything from code behind, from creating div to hidding div...

Please help how should i assign links for the anchor tag, to make it work..

Thanks and regards Abbas Electricwala.


An anchor tag, to become a clickabe link, must have a HREF attribute

For example

<a href="http://stackoverflow.com"> StackOverflow! </a>


as i understand you want to show a div whenever a link is clicked on page you are developing. then you should work on client side. with jquery you can do this. for example this code is supposed to prevent click and shows alert.

 $("a").click(function(event) {
                event.preventDefault();
              alert('link clicked');
}

for more information you can dig into jquery,

http://api.jquery.com/selector

http://api.jquery.com/click

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜