mootools

document.body is null

I've got a page where I'm using Mootools 1.2.4 and MediaboxAdvanced as a lightbox. I can't seem to get the thing working because of a particular javascript error document.body is null at the initialization of Mediabox: $(document.body).adopt( $$([ overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", clo...

Dependent dropdowns or similar, using mootools, php and MySQL

I need to find some way of displaying a drop-down menu that depending on what is chosen will display a second tier of results in another drop-down. All data will be stored in database. Any other similar techniques are welcome. I am currently using mootools, with php and Mysql. Any help or thoughts welcome on this one... ...

Mootools ajax form response

I'm trying to send a form with mootools and depending on the response from the php script do such or such thing. The thing is I fail to be able to use conditional statements inside of the onComplete part of the code. I'm missing something really obvious probably, please help me :) $('formName').addEvent('submit', function(e){ e.st...

How do I convert this snippet to Mootools

I have a Prototype snippet here that I really want to see converted into Mootools. document.observe('click', function(e, el) { if ( ! e.target.descendantOf('calendar')) { Effect.toggle('calendar', 'appear', {duration: 0.4}); } }); The snippet catches clicks and if it clicks outside the container $('calendar') should to...

How to programmatically click an element with MooTools?

In jQuery, I've done stuff like this in the past: $('#someCheckbox').click(); And everything works as if the user just clicked on the element normally. However the same doesn't work in MooTools: $('someCheckbox').fireEvent('click'); The checkbox doesn't get checked, nor do any of the bound event handlers fire. Is there a way to d...

Anonymous class with MooTools.

Can I create the anonymous class(java term) using the MooTools js framework? Suppose it should look like: A = new Class({ invoke: function() { alert('class'); } }); a = new A({ invoke: function() { this.parent(); alert('instance'); }, }); But I don't want to modify constructor interface around to accept additiona...

jQuery Live implementation in Prototype

Element.implement({ addLiveEvent: function(event, selector, fn){ this.addEvent(event, function(e){ var t = $(e.target); if (!t.match(selector)) return false; fn.apply(t, [e]); }.bindWithEvent(this, selector, fn)); } }); $(document.body).addLiveEvent('click', 'a', function(...

Sort list box options using mootools1.2

Hi all Below is my HTML <select name="name" id="id"> <option value="1">ZZZ</option> <option value="1">PPP</option> <option value="1">SSS</option> <option value="1">AAA</option> </select> I want that this select box will be sorted according to below. <select name="name" id="id"> <option value="1">AAA</option> ...

How to find an element inside another element in mootools

Let's say i need to find all .bar elements inside an element that's assigned to a variable foo. In jQuery, foo.find('.bar') solves the problem. What's the equivalent function in mooTools? ...

MooTools Fx.Slide throwing this.element is null

The following code is throwing the error "this.element is null". However, the wid_cont is definitely grabbing an element. window.addEvent('domready',function(){ var min = $(document.body).getElements('a.widget_minimize'); min.addEvent('click', function(event){ event.stop(); //var box = ; var wid_cont = ($(this).getParents('...

Mootools - how to get value of selected radio input type, from its name

Question 1: Given <input type="radio" name="foo" value="1" /> <input type="radio" name="foo" value="2" /> <input type="radio" name="foo" value="3" /> In Mootools, how do I return "2" given an input of "foo", assuming that the second radio button was clicked. Question 2: (it's related)- Given similar checkbox inputs, how do I retur...

Javascript object dependencies

In complex client side projects, the number of Javascript files can get very large. However, for performance reasons it's good to concatenate these files, and compress the resulting file for sending over the wire. I am having problems in concatenating these as the dependencies are included after they are needed in some cases. For instan...

Mootools: Formcheck tips over lightbox

I have a form on a lightbox, that form is server side validated with PHP (no issues there) and client side validated with formCheck for Mootools, Is it possible to show the error messages on top of a lightbox? By default it shows them under the lightbox, and therefore useless to the user filling the form, since they cannot be seen. Any...

Web GUI design issue

I'm writing a page with several text fields and a drop down. The fields in the drop down affect the value of the text fields. For example: the drop down options are "a" and "b". The text fields are "name" and "last name". When choosing "a", "name" is filled with "Joe". When choosing "b", "name" is filled with "Bob". I've written a class...

fetch HTML Element object using javascript, mootools

Hi, Please check my HTML below: <table cellpadding="0" cellpadding="0" border="0"> <tr> <td> <div class="toogler">Demo1</div> </td> </tr> <tr> <td> <div class="element">Demo1 Content</div> </td> </tr> <tr> <td> <div class="toogler">Demo1</di...

Javascript, IE, Strings, and Performance problems

Hey guys, So we have this product, and it's really slow in IE. We've already applied a lot of the practices advised by the IE guys themselves (like this, and this), and try to sacrifice clean code for performance in the critical parts like DOM manipulation. However, as you can see in this IE profiler screenshot.. Just "String" is the...

mootools: $ not defined

I've strange error i don't understand. I'm just moving my code from jQuery over to Mootools because it's much cleaner than the jQuery mess. Now when i use the $$('div.canvas') in mootools i get the correct element. When i try $(document).getElement('div.canvas') it tells me that $ is not defined. How can $$ and all helper funct...

Getting iframe content with $() (update: In mootools)?

how do i minify this in mootools. window.frames['buffer'].document.body.innerHTML in mootools, this does not work: $('buffer').$('body').get('html'); OR $('buffer').get('html') ...

Disable Clipboard & Print Screen on webpage

i search online but can't get satisfactory result i want to protect images on my website, i know i can disable save as, right click. the real question is can we Disable Clipboard & Print Screen with JQUERY or java script. so no image copy from print screen. thanks ...

Change event on <select>

If i attach a change event listener on a<select> how do i acces the option that was selected (not just the value, the actual element). $('select').addEvent('change',function(event) { //?? }); Note: i'm using Mootools ...