I was coding and everything was fine then visual studio code got an update and then it ended up like this and it is the latest update as of the time of posting:

BTW, I checked the jQuery's file source just to make sure and it was correct.
Ok, @charlietfl sugessted that I should remove
$(document).ready(function());it got better but I still end up with this :![]()
But I thought that using the .ready() was important to make sure that the DOM has loaded fully and then the JavaScript code happen. Are there any alternatives that do the same?
after looking at the API documentation of the JQuery I found that .ready() function is deprecated should be called like below but it didn't say that the .click() method is deprecated but it was also fixed using this other way of using it and it was the ESLinter that was giving me a hard time:
$(function () {
function addClass() {
$("#div1").addClass("divStyled");
}
function removeClass() {
$("#div1").removeClass("divStyled");
}
function toggleClass() {
$("#div1").toggleClass("divStyled pStyled");
}
function CSS1() {
var padding = $("#div1").css("padding-left");
$("#p2").html(padding);
}
$("#btnClick1").on("click", addClass);
$("#btnClick2").on("click", removeClass);
$("#btnClick3").on("click", toggleClass);
$("#btnClick4").on("click", CSS1);
});
after looking at the API documentation of the JQuery I found that .ready() function is deprecated should be called like below but it didn't say that the .click() method is deprecated but it was also fixed using this other way of using it and it was the ESLinter that was giving me a hard time:
$(function () {
function addClass() {
$("#div1").addClass("divStyled");
}
function removeClass() {
$("#div1").removeClass("divStyled");
}
function toggleClass() {
$("#div1").toggleClass("divStyled pStyled");
}
function CSS1() {
var padding = $("#div1").css("padding-left");
$("#p2").html(padding);
}
$("#btnClick1").on("click", addClass);
$("#btnClick2").on("click", removeClass);
$("#btnClick3").on("click", toggleClass);
$("#btnClick4").on("click", CSS1);
});
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