I have started to convert a code on my site to jquery from mootols I would like to include jQuery instead of mootools and then write some functions I’m using in mootools to jQuery so I can use the exact same code. Some of the code I’m using I already converted is for example:
jQuery.fn.addEvent = jQuery.fn.bind;
However I’m having a hard time doing these:
$some_node.getElement('.class'); //where $some_node is an element like $(.selector);
$some_node.addClass('class');
$some_node.fireEvent('focus');
_node.setProperty('disabled', 'disabled').addClass('disabled');
$btn_node.removeProperty('disabled').removeClass('disabled');
Is there something out there for this?
Assuming the
$some_nodeis a jQuery object, then the function equivalent in jQuery would begetElement('selector')should befind('selector').first(), asgetElementin Mootools seems to return the first element, thusfirstis used to reduce thefindresult array back down to one.addClass('class')is just…addClass('class'). Can’t see why you would have trouble with this.fireEvent('event')should betrigger('event')setProperty('attribute', 'value')should beattr('attribute', 'value')removeProperty('attribute')should beremoveAttr('attribute')Of course there almost certainly are subtle differences between the functions in both languages, most of which I cannot point out as I am unfamiliar with Mootools.