This is more of an organization issue regarding jQuery.
Using the following simple example:
<a href="#" class="click">click me</a>
<script>
$(document).ready(function(){
$('.click').on('click',function(){
alert('Clicked!');
});
});
</script>
Now multiply this by 1000 on your site, it can get confused quickly. You can also forget which classes you attributed for jQuery or for your CSS. I usually try to avoid mixing both, so I add my classes for CSS and others for jQuery, in case I change the layout or use this section somewhere else ... I can change CSS. But how do you remember which one is for CSS or jQuery? Do you call your classes "JSclassName" or something like that?
Let me know if I do not understand and thanks for your help.
source
share