Jquery DOC Ready Function

Basic jQuery document ready snippet

First part is the jQuery library call. Then the doc ready code below it. I realize this is super basic but I copy paste everything. I don’t trust my memory and certainly don’t trust my spelling so I live by the paste. I threw in a click function just because it’s almost a guarantee I use it in every page script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
 
<script> 
 
$(document).ready(function() { //12PM DOC READY
          
  $( ".myClass" ).click(function() {
    var button_id = $(this).attr("data-id");
    alert(button_id);
  });
 
}); //12PM DOC READY
 
</script>
Comments