code_junkie

jQuery, attribute filter selectors and finding out exactly _which_ element was clicked

Nov 13th, 2011
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. $("li[id^='shop_id']").click( function () {
  2.  
  3. alert("I clicked on id ??");
  4.  
  5. });
  6.  
  7. $("li[id^='shop_id']").click( function () {
  8. var current_id = $(this).attr("id");
  9. alert(current_id);
  10. });
  11.  
  12. <script type="text/javascript">
  13. $("li[id^='shop)id']").click(function(){
  14. alert($(this).attr('id'));
  15. });
  16. </script>
Add Comment
Please, Sign In to add comment