solution for prototype.js and jquery.js conflict problems

Jquery have provide a solution for prototype.js and jquery.js conflicts. There is one caveat: By default, jQuery uses “$” as a shortcut for “jQuery”. However, you can override that default by calling jQuery.noConflict() at any point after jQuery and the other library have both loaded. For example:

<script src=”prototype.js”><⁄script>
<script src=”jquery.js”><⁄script>
<script>
var $j =jQuery.noConflict();
$j(document).ready(function(){

⁄ ⁄ Use jQuery via $j(…)
$j(‘#button1’).click(function(){
var textbox1 = $j(‘#textbox1’).val();
alert(textbox1);

});

⁄ ⁄ Use Prototype with $(…)
$(‘someid’).hide();

}
<⁄script>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: