Co2 Co2 - 1 year ago 125
CoffeeScript Question

noConflict in Coffeescript?

I have the following JavaScript for a datepicker in my rails application but I want to use coffeescript and I am wondering how to implement no conflict on this function in coffeescript?

var $j = jQuery.noConflict();
initialDate: '02-12-1989',
format: 'dd-mm-yyyy',
disableDblClickSelection: true

Also the above works but I have to refresh the page before it does. Any advice on both? Thanks.

Answer Source

Here's what it might look like in CoffeeScript.

$j = jQuery.noConflict()
$ ->
    initialDate: '02-12-1989'
    format: 'dd-mm-yyyy'
    disableDblClickSelection: true

When it runs in the browser it's still running as JavaScript so the functionality jQuery.noConflict() offers is still going to be there.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download