Why we are used JQuery?and which is best jQuery or JavaScript?Ask Questions

 Posted on 07/12/2018

expalin with JQuery related one example and one another javascript ralated example?

and bothe within which is best
Share On: facebook gplus twitter
profile
Asked by Hardik Parekh on 07/12/2018 Score: 234 points
Add Comment:

Comments

1 Answers

0 Corrected Answers
Aproved Answers
0
Profile
Answered by hardik chaudhary on 8/14/2018 8:45:14 AM Score: 454 points

What is JQuery?

Before JQuery, developers would create their own small frameworks (group of code) this would allow all the developers to work around all the bugs and give them more time to work on features, so the JavaScript frameworks were born. Then came the collaboration stage, groups of developers instead of writing their own code would give it away for free and creating JavaScript code sets that everyone could use. That is what JQuery is, a library of JavaScript code. The best way to explain JQuery and its mission is well stated on the front page of the JQuery website which says:

JQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.

As you can see all JQuery is, is JavaScript. There is more than one type of JavaScript set of code sets likeMooTools it is just that JQuery is the most popular. Which is better to use JavaScript or JQuery? This is a question that is constantly asked.

 

Example One JQuery changing the background color of a body tag

 

$('body').css('background', '#ccc'); 

 

What is JavaScript?

JavaScript is a computer language that is used inside your web browser. It is dominantly used for interface interactions (meaning the flashy moving parts inside your  website). If you have every seen a slide show on the internet like the image below it is more likely to be JavaScript Scripting that will be doing the hard work behind the scenes. But JavaScript can do much more if you have a Gmail account with Google the email client uses JavaScript to create the features and functionality creating a rich user experience. Being a very powerful computer language it has the advantage of being easy to learn so a new developer can pick it up in a very short amount of time. It was created to be very readable and flexible, Wikipedia have a great description of JavaScript. In the past, JavaScript had issues with each web browser having its own way of implementing it, this created bugs and developers would spend more time fixing the bugs. This made it hard to work with. Today that is not so much of an issue as all the major web browsers conform to a standard meaning that these bugs are not great issues anymore.

Below is an example of a JavaScript Image Slide Show.

 

Example Two JavaScript function to change the background color with the onload function that would need to placed into the body tag

function changeBackground(color) {
   document.body.style.background = color;
}
onload="changeBackground('red');"

 

Comments

Add Comment:

Post Your Answers

Existing Members

Sign in to your account
Email Address
Password
New Member?
Sign up and complete profile
Full Name
Email Address
I have read and agree to the Terms of Service and Privacy Policy
Please subscribe me to the StoodQ newsletters
Guideline to answer a question:

Useful tips to submit your answer
Please read below guidelines before you submit your answer for question.

  • Read and understand question for which you are submitting your answer.
  • Try to avoid grammatical and spell mistake while answering.
  • Do not post any irrelevant information in your answer.
  • Explain your answer with example or any reference link to help who posted question.
  • If you find irrelevant question, please report it to support. Click here to contact support.
  • You agree to the privacy policy and terms of use to submit any contents.

Note: StoodQ is online developers community which helps developer for their difficulty, lets help them with your value contribution.