Jquery tips | SoloLearn: Learn to code for FREE!


Jquery tips

hi πŸ˜„πŸ˜„ What's the usefulest keywords in Jquery please ? πŸ€”πŸ™‰

10/26/2017 5:13:18 PM


36 Answers

New Answer


ben alors finalement on se met au Jquery ? πŸ˜† si tu veux qu'un code Jquery fonctionne, encadre le toujours de $(document).ready(function () { //ton code; }); et la quasi totalité du jquery sera le $("#tonID") ou $(".taClass") .ceQueTuVeuxFaire(); --> .attr .css .animate .hide .show .fadeIn .fadeOut .delay et plein d'autre. renseigne toi sur internet. et tu peux faire par exemple : $("body").hide(500).delay(1000).show(500); et ton body disparaîtra en 0.5s et 1s après il reapparaitra en 0.5s. tu peux aussi l'ecrire : $("body") .hide(500) .delay(1000) .show(500); en plusieurs lignes, c'est possible. $(maVariable) $("monTag") $(".maClass") $("#monID") https://code.sololearn.com/WQ1LXrV2Sf3u/?ref=app https://code.sololearn.com/W0pNLQ8bef6J/?ref=app https://code.sololearn.com/WC4Ncb88P3rB/?ref=app


The two things I enjoy most about jQuery is that you can use $() to specify selectors (IDs/classes) instead of having to type out the drawn out stuff that vanilla JS uses to specify an element; that alone makes jQuery worthy imo. My other fav thing about jQuery is how it handles AJAX. Btw, another cool thing about jQuery is that you can chain things together. EXAMPLE: $(selector).hide().show() ^Makes it really easy to perform multiple functions on a particular element without having to do it individual for the same element.


thanks for your answer πŸ˜„πŸ˜„πŸŒŒπŸ‘


thanks for all answer πŸ˜„πŸ˜„


thanks πŸ˜„πŸ˜„πŸŒŒπŸ‘


thanks Andrew G πŸ˜„πŸ˜„πŸŒŒπŸ‘


$ πŸ˜ƒ


You're more than welcome. If you know JavaScript already, jQuery is what you would call a Godsend. Just be warned though, once you get good at jQuery, you'll shudder at having to use vanilla JS again. :D Btw, another cool thing about jQuery is that you can chain things together. EXAMPLE: $(selector).hide().show() ^Instead of writing out multiple lines, you can chain them together like that and it'll execute it as if it was two separate statements. As far as I know, I don't think there is a limit to how many you can chain together. Obviously, do it when it's appropriate and related, and it'll save you some time / lines of code.


"#" for ids and "." for classes


@Netkos Ent nice info . I used JQuery. but I didn't know about chain thing . Thanx 😊😊😊


what is use?


Useful keyword : $(document).ready(function(){ }); 😊😊


.attr() ↑ It's Godsent. With boring old JavaScript and HTML, you could only set and manipulate one id value per element. But with Jquery's "$(selector).attr()", you can get and change the id value of any element. Also, you can create a custom attribute, set a value to it, and then manipulate it. Example: >>HTML <span id="example" num="one" > example </span> >>JS (jquery) var custom_attr = $("span").attr("num"); alert(custom_atrr); //alerts "one" //here, I got the value of a custom attribute. $("span").attr("id", "first_example"); alert( $("span").attr("id") ); //alerts "first_example" //↑ here, I changed the id of an element.


@kapil yadav, jquery is js library, and with 4 lines of js you do 1 line of jqury. go see my code to know more


it's a javascript library that make javascript easier to use.




ajax! is so sweet πŸ˜€πŸ‘


dont forget to bring the src= script


@Claudio You got that right :D That was one of the happiest days of my life.