Guest User

Untitled

a guest
Jul 20th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <ul id="selectable">
  2. <li>John Doe
  3. <br/>(111) 222-3333
  4. <br/><a href="mailto:john.doe@blah.com">john.doe@blah.com</a>
  5. <br/>
  6. <a href="/comments?user=15">3 comments</a>
  7. <br/>
  8. <br/>
  9. <a href="/users/15/edit">Edit</a>
  10. <a href="/users/15" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete</a>
  11. <hr/>
  12. </li>
  13. <li>Jane Smith
  14. <br/>(222) 333-4444
  15. <br/><a href="mailto:jane.smith@blah.com">jane.smith@blah.com</a>
  16. <br/>
  17. <a href="/comments?user=17">1 comment</a>
  18. <br/>
  19. <br/>
  20. <a href="/users/17/edit">Edit</a>
  21. <a href="/users/17" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete</a>
  22. <hr/>
  23. </li>
  24. </ul>
  25.  
  26. <script>
  27. $(function() {
  28. $( "#selectable" ).selectable({
  29. selected: function(ev, ui) {
  30. //insert code here?
  31. }
  32. });
  33. });
  34. </script>
  35.  
  36. <ul id="selectable">
  37. <li>John Doe
  38. <br/>(111) 222-3333
  39. <br/><a href="mailto:john.doe@blah.com">john.doe@blah.com</a>
  40. <br/>
  41. <a href="/comments?user=15">3 comments</a>
  42. <br/>
  43. <br/>
  44. <a href="/users/15/edit">Edit</a>
  45.  
  46. <a href="/users/15" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete</a>
  47. <hr/>
  48. </li>
  49.  
  50. </ul>
  51.  
  52. $(function(){
  53.  
  54. $('#selectable').selectable({
  55. selected: function(ev, ui) {
  56. //maybe do something
  57. }
  58. });
  59.  
  60. $('#selectable li a').click(function(){
  61. var url = $(this).attr('href');
  62.  
  63. if ($(this).data('confirm')) {
  64. var answer = confirm($(this).data('confirm'));
  65. var method = $(this).data('method');
  66. if (method && answer) {
  67. // execute method?
  68. // do redirect?
  69. window.location = url;
  70. }
  71. } else {
  72. window.location = url;
  73. }
  74. });
  75.  
  76. });
Add Comment
Please, Sign In to add comment