Skip to content

Instantly share code, notes, and snippets.

@scopevale
Created February 8, 2012 11:17
Show Gist options
  • Save scopevale/1768251 to your computer and use it in GitHub Desktop.
Save scopevale/1768251 to your computer and use it in GitHub Desktop.
Prototype jQuery noConflict test - 2
div {
display: none;
}
<button id="jQueryButton1">jQuery Button 1</button>
<button id="ProtoButton1">Prototype Button 1</button>
<div id="jQueryDiv1">This is displayed using Prototype - click me</div>
<div id="ProtoDiv1">This is displayed using Prototype</div>
/*global $: true, window: true, base_url: true, show_shift_division: true, jQuery: true, document: true, sprintf: true, alert: true, console: true, plotGraph: true*/
Event.observe(window, 'load', function(ev) {
$('ProtoButton1').observe('click', function(ev) { $('ProtoDiv1').show(); return false; });
$('jQueryButton1').observe('click', function(ev) { $('jQueryDiv1').show(); return false; });
});
jQuery.noConflict(true)(function(jQ) {
jQ('#jQueryDiv1').bind('click', function(ev) {
jQ('#jQueryButton1').unbind('click');
$(this).html('This is NOW displayed using jQuery');
jQ('#jQueryButton1').bind('click', function(ev) {
jQ('#jQueryDiv1').toggle();
});
console.log('clicked #jQueryDiv1');
return false;
});
});
name: jsFiddle/Gist demo - Prototype jQuery noConflict()
description: jsFiddle demo hosted on Gist using Prototype & jQuery/jQueryUI
authors:
- Gary Smith
title:
- JS Fiddle - Prototype jQuery noConflict()
resources:
- /js/empty.js
- https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js
- https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js
- https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
- http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/start/jquery-ui.css
- https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js
- https://getfirebug.com/firebug-lite-debug.js
normalize_css: yes
...
@scopevale
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment