23 thoughts on “jQuery vs Javascript

  • May 14, 2019 at 17:51
    Permalink

    What a pile of shit! document.querySelector(“.Goodbye”).className = “selected”;
    Single line coding with Vanilla JS.

  • May 14, 2019 at 17:51
    Permalink

    can you do the EXACT same thing with Jquery or learning java script is preferable? how about for the more elaborate stuff? I am new to coding?

  • May 14, 2019 at 17:51
    Permalink

    What about the following line instead of five lines JS:
    document.getElementsByClassName("goodbye")[0].className = "selected";
    would also work

  • May 14, 2019 at 17:51
    Permalink

    is there an advantage to using javascript instead of jquery? should I learn both? just one of them? i don't get it. It just seems like jquery is way simpler but jquery says it uses javascript language so i don't understand that.

  • May 14, 2019 at 17:51
    Permalink

    Thank you a lot. I'm learning code from a free website which is working great but i never understood how these two terms differentiate. Now, everything is cleared up!

  • May 14, 2019 at 17:51
    Permalink

    Personally I do love using jQuery but I will have to say that he didn’t use the same logic/algorithm to just adding class if you follow my example you can see this could be done with pure js with two lines of code.
    //js
    var element = document.getElementById("myDIV");
    element.classList.add("mystyle");
    //jquery
    $("#myDIV").addClass("mystyle");

  • May 14, 2019 at 17:51
    Permalink

    When we begin to learn a new language and arrive at functions, the first thing we learn about them is that functions are there so that we don't have to retype the same code again and again everytime we want to use the sequence of code. So thank you, captain Obvious, for stating that jQuery is exactly that.

  • May 14, 2019 at 17:51
    Permalink

    You can add a class to JavaScript waaaaaaaaaaaaaaaaaaaay easier than what you shiwed.. not very useful, thank you very much (ironic)

  • May 14, 2019 at 17:51
    Permalink

    Maybe if you are using JavaScript from 2008. Why not use "classList.add('selected')"? I think you need to brush up on your JS my friend

  • May 14, 2019 at 17:51
    Permalink

    Wow, THANK YOU for presenting this so clearly. I was sporadically using jQuery without really understanding what any of the code meant (just copy / pasting code I would find to achieve what I needed to do, asking more experienced designers for help etc.). I knew I needed to step my game up from just html, css, and bootstrap so for the past 2 months have been teaching myself JavaScript. Long story short, recently someone tried to explain to me that what I have been learning (JavaScript) is "un-simplified" jQuery. I had no idea lol! But when they tried to explain how the two languages are tied together I was left confused. This really cleared up the basic correlation for me!

  • May 14, 2019 at 17:51
    Permalink

    I really like the way you present your information but I think your example is a little flawed. The same result could be achieved with just javascript with this one line:

    document.querySelector(".goodbye").classList.add("selected");

    while the jQuery is shorter. It's not as drastic. I'm not sure if you were using that long-form example to emphasize your point more but I just wanted to point that out.

Leave a Reply