Resolving conflicts on DWR with jQuery

July 4, 2009 at 4:41 pm (Uncategorized)

Since DWR’s util.js uses $ as an alias to ‘dwr.util.byId’ function, it may not have a smooth integration with jQuery as $ is also used by the latter as a function alias. In order to resolve this conflict, one could follow snippet:

<script type='text/javascript' src='/mycontext/js/jquery-1.3.2.min.js'></script>
<script type="text/javascript">
    var jq = jQuery.noConflict();
</script>
<script type='text/javascript' src='/mycontext/dwr/engine.js'></script>
<script type='text/javascript' src='/mycontext/dwr/util.js'></script>
<script type="text/javascript">
   jq(document).ready(function()
   {  //other function calls
   });
</script>

‘jq’ variable defined in place of $ to invoke the rest of other jQuery functions.

dwr/util.jsfor

6 Comments

  1. Jaylord said,

    tnx bro..u save me

  2. Intesar Shannan Mohammed said,

    Thanks worked perfectly

  3. Paul fishing said,

    Great site, I have added this page to my social bookmarks

  4. Irfaan said,

    This saved me a lot of time. Awesome Post.

    Worked perfectly.

  5. Yoann said,

    Great trick, thanks!

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.