Tuesday, December 8, 2009

Prototype.js in lightbox or thickbox conflicts with jquery.js asp.net,javascript,c#.net,solution

Before discussing about the problem we have to see wt is jquery is and what is prototype is.jQuery emerged as solution for cross platform rich media applications. A featured content gallery , image sliders are few examples of the jquery.

A fast, concise, library that simplifies how to traverse HTML documents, handle events, perform animations, and add AJAX.

Prototype provides class-style Object Oriented and AJAX, freely distributable under the terms of an MIT-style license. Prototype are used with image manipulations and galleries and slitter differ from the Jquery.

When doing one blog application i have to use both of these libraries. But thre are conflicts between these two. These two libraries will clash each other if we use them in same page.

The reason for clash is the shortcut using for Jquery ie $. The solutions for these problem are discussing below.

1. Override the $-function

The first solution is override these $ with jQuery.noConflict(). This is achieved by use this override function at the header below the jquery tag.


2. Use 'Jquery' instead of $ in the html page

This is the simple way ie avoid jquery shortcut $ and use the keyword JQuery itself


HAPPY PROGRAMMING

2 comments:

  1. 2nd one worked thanks a ton
    saved my job! :D

    ReplyDelete
  2. THANK YOU SO MUCH ! the second idea work fine !

    ReplyDelete