Sree Sree - 9 months ago 39
jQuery Question

Is Using Javascript inside a jQuery function is a bad practice?

I know basics of both jQuery and JavaScript.I would like to follow a good coding practice. Is using JavaScript inside a jQuery function is a bad practice?

For exapmle:

$(document).ready( function() {
$('#dqualification').change(function() {
document.getElementById("demo").innerHTML = "Resolve following errors";


Nope, its fine, and it's done all the time.


$("myDiv").on("click", function(){
    var a = this;

The line var a = this; is pure JavaScript. There is no "jQuery Version" of var a = this;.

jQuery provides convenient ways of doing things in JavaScript that might be difficult to write and code yourself in pure JavaScript. It doesn't replace JavaScript, it just 'adds to it'.

Remember, jQuery is just JavaScript library. So everything ends up as JavaScript at the end of the day.

That first comment is a joke btw.