Last post Aug 08, 2019 04:24 AM by fatihbarut
Aug 07, 2019 01:57 PM|fatihbarut|LINK
document.getelementbyId("myinput").value instead of ("#myinput").val()
because eventhough it doesn't take so much still using Jquery instead of js feels like I waste some little resources.
what do you think?
Aug 07, 2019 02:28 PM|bruce (sqlwork.com)|LINK
they are not exactly the same. if "myinput" is not found, the getElementById().value ttrows an error, while the jQuery version returns undefined.
I seldom use jQuery anymore, but when I do, I like the consistency of the same api (readability) over performance.
if you switch to vanilla js, then use document.getElementById, document.querySelector() and fetch instead of $.ajax()
note: jquery is most helpful if you still support old browsers.
Aug 08, 2019 01:49 AM|Yang Shen|LINK
As far as i know, JS is a scripting language with its own variables and methods. It is mainly used for form validation, interaction with users and dynamic effects, with powerful functions.
But sometimes it's troublesome to use, so there's the jQuery framework. It is to encapsulate the common methods of JS to form its own structure. Need to load the jQuery library when you use it. With jQuery, you can do more with less code.
Please refer to Here, you can see detail about the difference between JS and jQuery
inclucing the performance.
Aug 08, 2019 04:24 AM|fatihbarut|LINK
thanks for the link it shows good statistic.