{"id":5675,"date":"2021-03-20T07:36:10","date_gmt":"2021-03-20T07:36:10","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5675"},"modified":"2021-03-20T07:36:10","modified_gmt":"2021-03-20T07:36:10","slug":"basics-jquery-syntax-to-know","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/","title":{"rendered":"Basics jQuery Syntax to know"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Hide\/Show<\/strong> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With jQuery, you can hide and show HTML elements with the\u00a0<code>hide()<\/code>\u00a0and\u00a0<code>show()<\/code>\u00a0methods:<\/p>\n\n\n\n$(&#8220;#hide&#8221;).click(function(){\n  $(&#8220;p&#8221;).hide();\n});\n\n$(&#8220;#show&#8221;).click(function(){\n  $(&#8220;p&#8221;).show();\n});\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Fadein\/Fadeout<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With jQuery you can fade elements in and out of visibility.<\/p>\n\n\n\n$(&#8220;button&#8221;).click(function(){\n  $(&#8220;#div1&#8221;).fadeIn();\n  $(&#8220;#div2&#8221;).fadeIn(&#8220;slow&#8221;);\n  $(&#8220;#div3&#8221;).fadeIn(3000);\n});\n$(&#8220;button&#8221;).click(function(){\n  $(&#8220;#div1&#8221;).fadeOut();\n  $(&#8220;#div2&#8221;).fadeOut(&#8220;slow&#8221;);\n  $(&#8220;#div3&#8221;).fadeOut(3000);\n});\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Animation<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">for animate text or image etc.<\/p>\n\n\n\n$(&#8220;button&#8221;).click(function(){\n  $(&#8220;div&#8221;).animate({left: &#8216;250px&#8217;});\n}); \n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Chainning<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Chaining allows us to run multiple jQuery methods (on the same element) within a single statement.<\/p>\n\n\n\n$(&#8220;#p1&#8221;).css(&#8220;color&#8221;, &#8220;red&#8221;)\n  .slideUp(2000)\n  .slideDown(2000);\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery add css<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add css through jQuery<\/p>\n\n\n\n$(&#8220;p&#8221;).css(&#8220;background-color&#8221;, &#8220;yellow&#8221;);\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Event<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To handle event<\/p>\n\n\n\n$(&#8220;p&#8221;).click(function(){\n  \/\/ action goes here!!\n});\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Slide<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The jQuery slide methods slide elements up and down.<\/p>\n\n\n\n$(&#8220;#flip&#8221;).click(function(){\n  $(&#8220;#panel&#8221;).slideDown();\n});\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Remove<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To remove elements and content<\/p>\n\n\n\n$(&#8220;#div1&#8221;).remove();\n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Prop (For multiple properties and values:)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The jQuery prop() method is generally used to retrieve property values.<\/p>\n\n\n\n$(selector).prop({property:value, property:value,&#8230;})  \n\n\n\n<p class=\"wp-block-paragraph\"><strong>jQuery Has Class<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The jQuery hasClass() method is used to check whether selected elements have specified class name or not.<\/p>\n\n\n\n$(selector).hasClass(classname)\n","protected":false},"excerpt":{"rendered":"<p>jQuery Hide\/Show With jQuery, you can hide and show HTML elements with the\u00a0hide()\u00a0and\u00a0show()\u00a0methods: $(&#8220;#hide&#8221;).click(function(){ $(&#8220;p&#8221;).hide(); }); $(&#8220;#show&#8221;).click(function(){ $(&#8220;p&#8221;).show(); }); jQuery [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5675","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Basics jQuery Syntax to know - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Basics jQuery Syntax to know - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"jQuery Hide\/Show With jQuery, you can hide and show HTML elements with the\u00a0hide()\u00a0and\u00a0show()\u00a0methods: $(&#8220;#hide&#8221;).click(function(){ $(&#8220;p&#8221;).hide(); }); $(&#8220;#show&#8221;).click(function(){ $(&#8220;p&#8221;).show(); }); jQuery [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-20T07:36:10+00:00\" \/>\n<meta name=\"author\" content=\"Deepak K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Deepak K\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/\"},\"author\":{\"name\":\"Deepak K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/92f6c421a478799fed7f4ab29dea6da3\"},\"headline\":\"Basics jQuery Syntax to know\",\"datePublished\":\"2021-03-20T07:36:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/\"},\"wordCount\":198,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/\",\"name\":\"Basics jQuery Syntax to know - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-03-20T07:36:10+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/92f6c421a478799fed7f4ab29dea6da3\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/basics-jquery-syntax-to-know\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Basics jQuery Syntax to know\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/92f6c421a478799fed7f4ab29dea6da3\",\"name\":\"Deepak K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8ac4c8929d7142223954f0040f6c4f2ebc4cf11dd62b553c16bef21610494e65?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8ac4c8929d7142223954f0040f6c4f2ebc4cf11dd62b553c16bef21610494e65?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8ac4c8929d7142223954f0040f6c4f2ebc4cf11dd62b553c16bef21610494e65?s=96&d=mm&r=g\",\"caption\":\"Deepak K\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/deepak\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Basics jQuery Syntax to know - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/","og_locale":"en_US","og_type":"article","og_title":"Basics jQuery Syntax to know - scmGalaxy","og_description":"jQuery Hide\/Show With jQuery, you can hide and show HTML elements with the\u00a0hide()\u00a0and\u00a0show()\u00a0methods: $(&#8220;#hide&#8221;).click(function(){ $(&#8220;p&#8221;).hide(); }); $(&#8220;#show&#8221;).click(function(){ $(&#8220;p&#8221;).show(); }); jQuery [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/","og_site_name":"scmGalaxy","article_published_time":"2021-03-20T07:36:10+00:00","author":"Deepak K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Deepak K","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/"},"author":{"name":"Deepak K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/92f6c421a478799fed7f4ab29dea6da3"},"headline":"Basics jQuery Syntax to know","datePublished":"2021-03-20T07:36:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/"},"wordCount":198,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/","name":"Basics jQuery Syntax to know - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-03-20T07:36:10+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/92f6c421a478799fed7f4ab29dea6da3"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/basics-jquery-syntax-to-know\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Basics jQuery Syntax to know"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/92f6c421a478799fed7f4ab29dea6da3","name":"Deepak K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8ac4c8929d7142223954f0040f6c4f2ebc4cf11dd62b553c16bef21610494e65?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8ac4c8929d7142223954f0040f6c4f2ebc4cf11dd62b553c16bef21610494e65?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8ac4c8929d7142223954f0040f6c4f2ebc4cf11dd62b553c16bef21610494e65?s=96&d=mm&r=g","caption":"Deepak K"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/deepak\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=5675"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5675\/revisions"}],"predecessor-version":[{"id":5683,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/5675\/revisions\/5683"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=5675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=5675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=5675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}