code_junkie

Why Stackoverflow binds user actions dynamically with javascript?

Nov 11th, 2011
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. <a id="comments-link-xxxxx" class="comments-link">add comment</a><noscript>&nbsp;JavaScript is needed to access comments.</noscript>
  2.  
  3. // Setup our click events..
  4. $().ready(function() {
  5. $("a[id^='comments-link-']").click(function() { comments.show($(this).attr("id").substr("comments-link-".length)); });
  6. });
Add Comment
Please, Sign In to add comment