{"id":99,"date":"2009-07-15T18:24:37","date_gmt":"2009-07-15T18:24:37","guid":{"rendered":"http:\/\/beta.robertprice.co.uk\/robblog\/2009\/07\/using_jquery_and_mootools_on_the_same_page-shtml\/"},"modified":"2009-07-15T18:24:37","modified_gmt":"2009-07-15T18:24:37","slug":"using_jquery_and_mootools_on_the_same_page-shtml","status":"publish","type":"post","link":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/","title":{"rendered":"Using jQuery And Mootools On The Same Page"},"content":{"rendered":"<p>\nWhile it&#8217;s never a good idea to bloat your webpage with too much unneeded content, there are times when you can&#8217;t avoid it. One example I came across recently was with my day job&#8217;s adoption of <a href=\"http:\/\/www.jquery.com\/\">jQuery<\/a> as our official JavaScript framework, I needed to add some jQuery goodness to some blog pages belonging to a certain category in <a href=\"http:\/\/www.movabletype.org\">Movable Type<\/a>. Simple, right?\n<\/p>\n<p>\nWell the site in question already used <a href=\"http:\/\/www.mootools.net\/\">Mootools<\/a> extensively, so the jQuery would have to run nicely next Mootools and not disrupt existing functionality.\n<\/p>\n<p>\nThe designers of jQuery have designed for this sort of situation, and have provided a function called <a href=\"http:\/\/docs.jquery.com\/Core\/jQuery.noConflict\">noConflict<\/a> that returns the use of <var>$<\/var> to Mootools, or any other framework you may have installed as well.\n<\/p>\n<p>\nHere&#8217;s some example code to show both jQuery and Mootools running in the same page&#8230;\n<\/p>\n<div class=\"code\"><code>&lt;script type=\"text\/javascript\" src=\"jquery-1.3.2.min.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script type=\"text\/javascript\"&gt;&lt;!--<br \/>\njQuery.noConflict();<br \/>\n\/\/--&gt;<br \/>\n&lt;\/script&gt;<br \/>\n&lt;script type=\"text\/javascript\" src=\"mootools-1.2-core-yc.js\"&gt;&lt;\/script&gt;<br \/>\n<\/code><\/div>\n<p>\nIn my Movable Type situation, I am able to use a custom MT tag to make sure jQuery only appears for certain categories. Let&#8217;s assume I have a category called jQuery where I need the jQuery library to be imported, the <code>MTIfCategory<\/code> tag is what I need to guard with&#8230;\n<\/p>\n<div class=\"code\"><code>&lt;MTIfCategory label=\"jQuery\"&gt;<br \/>\n&lt;script type=\"text\/javascript\" src=\"jquery-1.3.2.min.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script type=\"text\/javascript\"&gt;&lt;!--<br \/>\njQuery.noConflict();<br \/>\n\/\/--&gt;<br \/>\n&lt;\/script&gt;<br \/>\n&lt;\/MTIfCategory&gt;<br \/>\n&lt;script type=\"text\/javascript\" src=\"mootools-1.2-core-yc.js\"&gt;&lt;\/script&gt;<br \/>\n<\/code><\/div>\n<p>\nWith this in place I can call jQuery functions using the <var>jQuery<\/var> variable, and MooTools using <var>$<\/var> where necessary.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While it&#8217;s never a good idea to bloat your webpage with too much unneeded content, there are times when you can&#8217;t avoid it. One example I came across recently was with my day job&#8217;s adoption of jQuery as our official JavaScript framework, I needed to add some jQuery goodness to some blog pages belonging to &hellip; <a href=\"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using jQuery And Mootools On The Same Page&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[31,32,40,75,78],"class_list":["post-99","post","type-post","status-publish","format-standard","hentry","category-dev","tag-javascript","tag-jquery","tag-mootools","tag-web-development","tag-work"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using jQuery And Mootools On The Same Page - Robert Price<\/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.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using jQuery And Mootools On The Same Page - Robert Price\" \/>\n<meta property=\"og:description\" content=\"While it&#8217;s never a good idea to bloat your webpage with too much unneeded content, there are times when you can&#8217;t avoid it. One example I came across recently was with my day job&#8217;s adoption of jQuery as our official JavaScript framework, I needed to add some jQuery goodness to some blog pages belonging to &hellip; Continue reading &quot;Using jQuery And Mootools On The Same Page&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/\" \/>\n<meta property=\"og:site_name\" content=\"Robert Price\" \/>\n<meta property=\"article:published_time\" content=\"2009-07-15T18:24:37+00:00\" \/>\n<meta name=\"author\" content=\"rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated 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.robertprice.co.uk\\\/robblog\\\/using_jquery_and_mootools_on_the_same_page-shtml\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_jquery_and_mootools_on_the_same_page-shtml\\\/\"},\"author\":{\"name\":\"rob\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"headline\":\"Using jQuery And Mootools On The Same Page\",\"datePublished\":\"2009-07-15T18:24:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_jquery_and_mootools_on_the_same_page-shtml\\\/\"},\"wordCount\":217,\"keywords\":[\"JavaScript\",\"jQuery\",\"Mootools\",\"Web Development\",\"Work\"],\"articleSection\":[\"Dev\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_jquery_and_mootools_on_the_same_page-shtml\\\/\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_jquery_and_mootools_on_the_same_page-shtml\\\/\",\"name\":\"Using jQuery And Mootools On The Same Page - Robert Price\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\"},\"datePublished\":\"2009-07-15T18:24:37+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_jquery_and_mootools_on_the_same_page-shtml\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_jquery_and_mootools_on_the_same_page-shtml\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_jquery_and_mootools_on_the_same_page-shtml\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using jQuery And Mootools On The Same Page\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\",\"name\":\"Robert Price\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\",\"name\":\"rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"caption\":\"rob\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using jQuery And Mootools On The Same Page - Robert Price","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.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/","og_locale":"en_GB","og_type":"article","og_title":"Using jQuery And Mootools On The Same Page - Robert Price","og_description":"While it&#8217;s never a good idea to bloat your webpage with too much unneeded content, there are times when you can&#8217;t avoid it. One example I came across recently was with my day job&#8217;s adoption of jQuery as our official JavaScript framework, I needed to add some jQuery goodness to some blog pages belonging to &hellip; Continue reading \"Using jQuery And Mootools On The Same Page\"","og_url":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/","og_site_name":"Robert Price","article_published_time":"2009-07-15T18:24:37+00:00","author":"rob","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rob","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/#article","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/"},"author":{"name":"rob","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"headline":"Using jQuery And Mootools On The Same Page","datePublished":"2009-07-15T18:24:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/"},"wordCount":217,"keywords":["JavaScript","jQuery","Mootools","Web Development","Work"],"articleSection":["Dev"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/","url":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/","name":"Using jQuery And Mootools On The Same Page - Robert Price","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website"},"datePublished":"2009-07-15T18:24:37+00:00","author":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"breadcrumb":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_jquery_and_mootools_on_the_same_page-shtml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robertprice.co.uk\/robblog\/"},{"@type":"ListItem","position":2,"name":"Using jQuery And Mootools On The Same Page"}]},{"@type":"WebSite","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website","url":"https:\/\/www.robertprice.co.uk\/robblog\/","name":"Robert Price","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robertprice.co.uk\/robblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5","name":"rob","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","caption":"rob"}}]}},"_links":{"self":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/99","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/comments?post=99"}],"version-history":[{"count":0,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}