Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. //No need to put inside $(document).ready
  2. $(document).on('click','a',function () {
  3. })
  4.  
  5. // Need to put inside $(document).ready if placed inside <head></head>
  6. $('.container').on('click','a',function () {
  7. });
  8.  
  9. $(document).ready(function() {
  10. console.log('ready!');
  11. });
  12.  
  13. $(function() {
  14. console.log('ready!');
  15. });
  16.  
  17. $(document).ready(function() {
  18. // Handler for .ready() called.
  19. });
  20.  
  21. $(document).ready(function(){
  22. bindelement1();
  23. bindelement2();
  24. });
  25.  
  26. function bindelement1(){
  27. $('el1').on('click',function...);
  28. //you might make an ajax call here, then under complete of the AJAX, call this function or any other function again
  29. }
  30.  
  31. function bindelement2(){
  32. $('el2').on('click',function...);
  33. }
  34.  
  35. <div id="advance-search">
  36. Some other DOM elements
  37. <!-- Here I wanted to apppend the link as <a href="javascript:;" id="reset-adv-srch"><span class="bold">x</span> Clear all</a>-->
  38. </div>
  39.  
  40. <script>
  41. $("#advance-search #reset-adv-srch").on("click", function (){
  42. alert('Link Clicked');``
  43. });
  44. </script>
  45.  
  46. $(document).ready(function(e) {
  47. $("#advance-search #reset-adv-srch").on("click", function (){
  48. alert('Link Clicked');
  49. });
  50. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement