{"id":1084,"date":"2015-12-14T08:09:45","date_gmt":"2015-12-14T08:09:45","guid":{"rendered":"http:\/\/www.advancedwebhelp.com\/blog\/?p=1084"},"modified":"2015-12-14T08:09:45","modified_gmt":"2015-12-14T08:09:45","slug":"jquery-ready-plus-conflict-resolution","status":"publish","type":"post","link":"https:\/\/www.advancedwebhelp.com\/blog\/2015\/jquery-ready-plus-conflict-resolution","title":{"rendered":"jQuery Ready Plus $ Conflict Resolution"},"content":{"rendered":"<p><a href=\"http:\/\/www.advancedwebhelp.com\/blog\/wp-content\/uploads\/2013\/11\/jquery-logo-s.jpg\" rel=\"attachment wp-att-329\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.advancedwebhelp.com\/blog\/wp-content\/uploads\/2013\/11\/jquery-logo-s-150x150.jpg\" alt=\"jQuery logo\" width=\"150\" height=\"150\" class=\"alignright size-thumbnail wp-image-329\" srcset=\"https:\/\/www.advancedwebhelp.com\/blog\/wp-content\/uploads\/2013\/11\/jquery-logo-s-150x150.jpg 150w, https:\/\/www.advancedwebhelp.com\/blog\/wp-content\/uploads\/2013\/11\/jquery-logo-s-148x148.jpg 148w, https:\/\/www.advancedwebhelp.com\/blog\/wp-content\/uploads\/2013\/11\/jquery-logo-s-31x31.jpg 31w, https:\/\/www.advancedwebhelp.com\/blog\/wp-content\/uploads\/2013\/11\/jquery-logo-s-38x38.jpg 38w, https:\/\/www.advancedwebhelp.com\/blog\/wp-content\/uploads\/2013\/11\/jquery-logo-s.jpg 208w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<p>Earlier in my notes to uses, I mentioned the method to initialized jQuery by using the jQuery ready pattern.    However at the time, I did not mention how to deal with $ conflict problems.   The $conflict problem is significant.   You would like to know that you are using the jQuery $ and it is correctly being interpreted in you code.   Sometimes, when used in PHP or with additional libraries like prototype, the meaning of $ gets confused.    Fortunately, it is VERY easy to assure that the $ is correctly interpreted in any script found in the jQuery ready initialization.    Option1, use the following setup as the jQuery Ready.<\/p>\n<pre><code>\r\n\r\nQuery(document).ready(function( $ ) {\r\n    \/\/ Your jQuery code here, using $ to refer to jQuery.\r\n});\r\n\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>If you would prefer to use the shortcut pattern for jQuery Ready, use the following:<\/p>\n<pre><code>\r\n\r\njQuery(function($){\r\n    \/\/ Your jQuery code here, using the $\r\n});\r\n\r\n<\/code><\/pre>\n<p> &nbsp;<\/p>\n<p>That&#8217;s it for now &#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier in my notes to uses, I mentioned the method to initialized jQuery by using the jQuery ready pattern. However at the time, I did not mention how to deal with $ conflict problems. The $conflict problem is significant. You would like to know that you are using the jQuery $ and it is correctly [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,13],"tags":[],"class_list":["post-1084","post","type-post","status-publish","format-standard","hentry","category-javascript","category-jquery"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/posts\/1084","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/comments?post=1084"}],"version-history":[{"count":2,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/posts\/1084\/revisions"}],"predecessor-version":[{"id":1088,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/posts\/1084\/revisions\/1088"}],"wp:attachment":[{"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/media?parent=1084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/categories?post=1084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.advancedwebhelp.com\/blog\/wp-json\/wp\/v2\/tags?post=1084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}