I would like to know the best practices when declaring jquery dom elements as variables. Any difference between
var div = $('div');
and
var $div = $('div');
besides better readability? Thanks
$div
simply gives an indication to the reader of the code that it represents a jQuery object. So no, there is no difference besides that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With