0 likes | 3 Views
jQuery, launched in 2006 by John Resig, transformed web development by simplifying JavaScript for DOM manipulation, event handling, and animations. It quickly became a favorite for ensuring cross-browser compatibility. However, with the rise of modern JavaScript frameworks like React and Vue, its popularity has declined. Despite this, jQuery's impact on web development remains significant, influencing how developers build interactive websites today.
E N D
AShortHistoryofJquery WhatisGOOGLEMYBUSINESS Let’sgobackandreviewthehistoryoffront-enddevelopment.Manyyearsagoiffront- enddevelopershadtodofonttagsandcolorattributestheyhadtoset tags. HTMLfilesweresaturated,andifthegoalwastochangethestyleof100pages,itwas manuallydoneforeachpage.Thisscenarioplayedoutastheworstnightmareforwebdevelopers.ThenalongcameCSS.Itallowedmanagingwebpagesstylefromoneplace. Asimilarsortplayedoutfor JavaScript. JavaScriptbecamepopularbyfollowinginthefootstepsofCSS.Itwasveryeasytouse andprovidedamuchbetteruserexperience. Bymid-2000sseveralpiecesofsilvercodefromJavaScriptlibraryhadbeenreleased. SomeofthoseareMOTOOLS,PROTOTYPE,DOJO,jQueryamong manyothers. JQuerybecamethetopchoiceofdevelopersforsiteinteractivityanduser experience. HTMLReliesonstructure CSSUsedforsiteappearanceandstyling
JQueryControlsthebehaviorofinteractivity WHATISJQUERY? • Yes,youreaditright.Writeless,domore.JQueryisafast,small,andfeature-rich JavaScriptlibrary.It’snosurprisethateventodayjQueryisthemostpopularlightweight libraryontheweb.ItusesthefunctionalityofJavaScripttomakeiteasyforaweb developertodonecessarytasks.Thesetasksmayinclude: • Manipulatingwebpages. • Respondingtouserevents. • Gettingdatafromwebservers. • Buildinganimationsandspecialeffects. • JQuerybuildsontopofthefunctionalitythatabrowsergivesusviaJavaScriptDOMAPI. ItsimplifiesHTMLDOM(DocumentObjectModule)treetraversal.WithjQuerytraversing, youcanstartfromanyelementandmoveup,down,andsidewaysintheDOMtree.In short,itwillperformafunctioninfarfewerlinesofcodethanearlier possible. • Wewilltrytounderstandbyusingsomeexamples: • Let’ssupposeyouwantedtoresizealltheimagesonyourwebpageorwantedtoadd someanimation.Youcouldchoosetowriteseverallinesofcode.Oryoucouldwritea singlelineofcodeandletjQuerydoalltheheavyliftingforyou.jQuerysimplymeansless codingtoachievethesameresults.NotonlythatjQuerywill alsotakecareofanycross- browserbugs,tomakelifeeasier. • DIFFERENCEBETWEENjQUERYAND JAVASCRIPT • Javascriptisaprogramminglanguage.WhilejQueryisasetcollectionoffunctionswritten usingJavascript.
WHATISJQUERYUSEDFORANDWHY? jQueryprovidesasetoffunctionswritteninJavascript.Theefforthasalreadybeenput inonce.Thereisnoneedtore-writethesefunctions.WithjQuery,youjustusethem whereyouwantto.Noneedtore-inventthewheel.Therearetonsoflibrariesoutthere youcanuseforyour convenience. jQueryhasseveralbenefitsoverrawJavaScript. JQueryis cross-browserapplicable. Itsaloteasier tousethanrawJavascriptwithlesscoding. Itisextensible(mechanismavailabletoextendtheprogramminglanguage). It’ssimpleandhasrichAJAXsupport. jQuerycomeswithexcellentdocumentation. Ithasalargedevelopercommunityandoffersmanyplugins. WHATISTHEMEANINGOF$INJQUERY Hereyoucanfindoutsymbolsandtheir meaning. • PointstoRemember • Ready()functionensuresthattheDOMisfullyloaded • $Itisshortfor jQuery • Allthreeofthefollowingsyntaxesareequaltoeachother: • $(document).ready(handler) • $(). Ready(handler)thisisnot recommended • $(handler)
HOWTOGETJQUERYONAWEBSITE • Herearetwo waystoaddjQueryto yourwebsite: • DownloadthejQuery libraryfromitssitewww.jquery.com. • IncludejQueryfromGoogleCDN(Content DeliveryNetwork) • Thereare2versionsavailablefordownloadingjQuery. • Productionversion–Usedforthelivewebsite.Thecodeisminifiedandcompressed. • Developmentversion–Usedfordevelopmentandtesting.Codeisreadableanduncompressed • YoucandownloadbothversionsfromthejQuerywebsite.ThejQuerylibraryisasingle javascriptfile.YoucanreferenceitwithHTML<scrip> • Note:<script>tagshouldbeinsidethetag<head> • <head> • <scriptsrc=”jquery-3.5.1.min.js”></script> • </head> • Butifyoudon’twanttodownloadandhostjQuery,youcanincludeitfromaCDN(Content DeliveryNetwork).GooglehostsjQuery,whichgoesbythenameofjQueryGoogleCDN. • GoogleCDNisthemostreliable,fast,andgloballyavailablecontentdeliverynetwork. jQueryhostedonGoogleCDNisagreatchoice.ThisisbecauseGoogleworksdirectly withallkeystakeholdersinvolved.Itupdateslibrariestothemostcurrentversionwith easeandconvenience.GooglerecommendsthatlibrariesareloadedfromCDNvia HTTPS.Thisisapplicableevenifyourwebsiteusesonly HTTP. • <head> • <scriptsrc=”https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js“> • </script> • </head> • CopyandpastetheHTMLsnippetforthelibrary(shownabove)foryourwebpage.