{"id":10,"date":"2009-04-02T19:18:00","date_gmt":"2009-04-02T19:18:00","guid":{"rendered":"http:\/\/www.codeboss.in\/web-funda\/?p=9"},"modified":"2009-04-02T19:18:00","modified_gmt":"2009-04-02T19:18:00","slug":"using-jquery-and-prototype-together","status":"publish","type":"post","link":"https:\/\/codeboss.in\/web-funda\/2009\/04\/02\/using-jquery-and-prototype-together\/","title":{"rendered":"Using jQuery and Prototype together"},"content":{"rendered":"<p>Yes. <span style=\"font-weight:bold;\">You can use jQuery and Prototype together in the same page<\/span>.<\/p>\n<p>I have been using jQuery and Prototype for quite some time now. But have always used them on different projects knowing for sure that if not anything else, their &#8216;$&#8217; would clash.<\/p>\n<p>However I found out a solution. <\/p>\n<p>By default the &#8216;$&#8217; in jQuery is used as the shortcut for the &#8220;jQuery&#8221; namespace. To override the default  jQuery.noConflict() needs to be called after the js files have been included. After that jQuery can be called with &#8220;jQuery&#8221; instead of &#8216;$&#8217; and hence there would be no confusion between the js frameworks.<\/p>\n<pre class=\"brush: jscript;\">\n<script type=\"text\/javascript\" src=\"prototype.js\"><\/script>\n<script type=\"text\/javascript\" src=\"jquery.js\"><\/script>\n<script type=\"text\/javascript\" >\njQuery.noConflict();\n\n\/\/ Use jQuery via jQuery(...)\njQuery(document).ready(function(){\n\/\/\/ code \/\/\/\n}\n);\n\n\/\/ Use Prototype with $(...), etc.\n$('someid').hide();\n<\/script>\n<\/pre>\n<p>Now using &#8220;jQuery&#8221; instead of &#8216;$&#8217; can be irritating. To use a short name create one like below &#8211;<\/p>\n<p>var $j = jQuery.noConflict();<\/p>\n<p>Now you can use jQuery like &#8211;<\/p>\n<p>$j(&#8220;div&#8221;).hide();<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes. You can use jQuery and Prototype together in the same page. I have been using jQuery and Prototype for quite some time now. But have always used them on different projects knowing for sure that if not anything else, their &#8216;$&#8217; would clash. However I found out a solution. By default the &#8216;$&#8217; in&hellip; <a class=\"more-link\" href=\"https:\/\/codeboss.in\/web-funda\/2009\/04\/02\/using-jquery-and-prototype-together\/\">Continue reading <span class=\"screen-reader-text\">Using jQuery and Prototype together<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,16],"tags":[51,53,61],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-javascript","category-jquery","tag-javascript-2","tag-jquery-2","tag-prototype","entry"],"_links":{"self":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":0,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}