All Questions
66
questions
208
votes
11
answers
216k
views
event.preventDefault() function not working in IE
Following is my JavaScript (mootools) code:
$('orderNowForm').addEvent('submit', function (event) {
event.preventDefault();
allFilled = false;
$$(".required").each(function (inp) {
...
7
votes
1
answer
6k
views
How to implement OnDestroy/OnDispose event in JS/Mootools?
Is there any existing OnDestroy/OnDispose event in JavaScript or are there any known custom implementations in plain JS or Mootools? Let's say I want to call console.log('bye') when an element gets ...
5
votes
1
answer
4k
views
Mootools: inject vs adopt
I want to dynamically add some preconfigured HTML-Elements in use of a 'click'-event with mootools.
So I can make it work with my basic knowledge, although it isn´t very nifty. I coded this so far...
...
3
votes
1
answer
432
views
Access class attribute in event handler in js-mootools
I have a JS object (working with mootools) wich has stored some DOM elements and attach to them event listeners:
window.myObject = {
init: function(el1ID, el2ID){
this.myElement1 = ...
3
votes
2
answers
1k
views
MooTools event listener disappears after element.innerHTML is changed
I am trying to achieve this task using MooTools.
Description:
I attached an event listener to myButton link. A click on this link initiates an AJAX request and updates myDiv content based on the ...
3
votes
1
answer
1k
views
How to determine error code on broken images with mootools
I need a script that can determine the reason an image didn't load based on the HTTP status code supplied.
I am aware of the onError event on images and objects, but it does not pass the error code. ...
2
votes
1
answer
373
views
In jQuery how to fire an elements event added in mootools?
I have a MooTools script (please dont ask why..) where elements are added a mouseenter event. In jQuery, I open/show those elements within a fancybox. When it pops up, the mouseenter event wont get ...
2
votes
2
answers
76
views
How to define an event that changes an element that has a different event?
Apologies for the vague title, it's kind of hard to explain in a line...
In any case, let's say I have a button with an action as defined by the data-action property. When the user clicks said button,...
2
votes
1
answer
606
views
mootools | Open/close popup menu and outer click event
I'm using mootools and working on popup menu:
document.getElement('.cart a').toggle(
function() {
this.getParent('div').removeClass('open');
this.getNext('.cart_contents').hide(); ...
2
votes
1
answer
780
views
Mootools: how fired a function (or more functions) after the end of a tween or morph FX or other event?
as title, I would to knoe how can I do to fired a function after the end of an event.
Thanks!
2
votes
2
answers
482
views
Event binding in MooTools like jQuery
Is there a way to assign a multiple event types in MooTools like jQuery?
Mootools:
$$('#id').addEvents({
keyup: fn,
click: fn
});
jQuery:
$('#id).bind('keyup click' ,fn);
2
votes
1
answer
1k
views
No Event object on Scroll Event in MooTools?
I am getting an undefined value for the event object that I think should be available in the callback for the addEvent() function. This is what I'm doing.
element.addEvent('scroll', callback(event) {...
2
votes
1
answer
83
views
how to control the back button with mootools?
This is how it looks for jQuery.
How can I achieve the same thing with Mootools?
$(window).on("navigate", function (event, data) {
var direction = data.state.direction;
if (direction == '...
1
vote
2
answers
1k
views
JavaScript event.target only reports child (MooTools)
I seem to get something fundamentally wrong. I have this HTML
<div id="thumbnails">
<a href="#image-0">
<img src="blabla-1.jpg" />
</a>
<a href="#image-...
1
vote
3
answers
2k
views
how to attach onclick event to an array of elements (mootools)
Is there a syntax for the following thing:
$$('.a-lot-of-elems').addEvent('someevent',somefunction);
1
vote
3
answers
3k
views
Event removal in Mootools, and syntax of event addition
So I have been adding my events thusly:
element.addEvent('click', function() {
alert('foobar');
});
However, when attempting to remove said event, this syntactically identical code (with "add" ...
1
vote
1
answer
115
views
Mootools Add click event with Drag.Cart
I use this example under jsfiddle.net, to build a drag&drop system and if I create a click event on shirts images (draggables), this event doesn't work.
How to combine drag and click events to ...
1
vote
1
answer
194
views
MooTools – Add class to page on click of anchor, with delayed loading of anchor link
I'm using MooTools to add two classes to the body on click of a link from a nav menu, which triggers an animated CSS fade of the page.
I want to delay the link from loading the new page until the ...
1
vote
3
answers
1k
views
Why can't I set my input field with MooTools?
Ive got a document and when the user enters something into one input I need to show a response in a second input box. I can get the user given value, i can process it, but when I try to set the second ...
1
vote
3
answers
325
views
Avoid anonymous function in Mootools?
Here's my problem: I'm looking for a way to work with 'not anonymous' function in Mootools.
Can't find a way to work it out, and I couldn't find doc about it.
Example:
var myInput = new Element('...
1
vote
1
answer
5k
views
Mootools doesn't fire the "onChange" event for Selects in IE7
I'm working with MooTools 1.2.4 and I have a select with an event "change" that works fine in Firefox but when I try to test it in Internet Explorer 7 it gives me an error saying that the ...
1
vote
2
answers
599
views
Dom Element onclick (MooTools :: optionally)
Consider the following example:
function async_callback(array1, array2, array3) {
// All arrays are equal length
for(var i = 0; i < array1.length; i++) {
var myElement = new Element('div',...
1
vote
1
answer
149
views
how to define a private event [Port Mootools to jquery]
I'am a big mootools fan.
But now I have to port a mootools-snipe to jquery and I do not get it.
I' am using this code:
var prev_m_x = 0;
var prev_m_y = 0;
window.addEvent('mousemove',function(e){...
1
vote
2
answers
820
views
Mootools: how to stop delay events with 'mouseenter' and 'mouseleave'
I'm quite a newbie with javascript and mootols and I've got a question about delay and event handling with Mootools.
My goal: the menu appears in a primary position, then after a certain time moves ...
1
vote
1
answer
675
views
Mootools: how to stop event, when other event happens
i´ve got a question about mootools eventhandling.
I wanna delay a mouseenter event for a dropdown navigation. After 1 second the drowdown list will be shown by "setStyle('display', 'block')...this ...
1
vote
1
answer
49
views
javascript/mootools | Custom events
I have 1-st script:
<script>
App.validate(helper, form, "", // Simple request to the server
function(data) {
if (data.products_in_cart) {
... I dont't know how to ...
1
vote
1
answer
68
views
Mootools class: call a class method from an event handler
is it possible to call a class method from within an event handler?
I mean, something like this:
initialize: function(options) {
/* initial options */
this.setOptions(options);
this.area =...
1
vote
2
answers
500
views
map keyboard keys with mootools
I am looking to make the enter key behave exactly like the tab key on a form.
I am stuck on the fireEvent section.
var inputs = $$('input, textarea');
$each(inputs,function(el,i) {
el....
1
vote
1
answer
1k
views
Javascript Mootools event stop
well,i have this script that i have set up that on submit requests php file that is used to validate my input values...i have set up that when it is not validated the correct way to echo it is not ...
1
vote
2
answers
96
views
How do you access an object instance in the second parameter of the Mootools fireEvent function?
I'm working through Implements: [Events, Options] in Mootools.
I would like to pass a class property to the function that is called when an event fires. I would have thought that I could do it using ...
1
vote
1
answer
478
views
Adding custom code to mootools addEvent
Even though I've been using mootools for a while now, I haven't really gotten into playing with the natives yet. Currently I'm trying to extend events by adding a custom addEvent method beside the ...
1
vote
2
answers
1k
views
MooTools request fails
I am trying to achieve this task using MooTools.
Description:
I have three buttons. Two buttons outside myDiv and one button inside myDiv.
A click on any of these buttons initiates an AJAX request (...
1
vote
2
answers
1k
views
Extending mootools Element.Events
I'd like to create a custom paste event that would fire either input (FF) or onbeforepaste (IE). I've read pretty much all about creating custom events in mootools, still the event does not get fired ...
1
vote
1
answer
496
views
Mootools overriding window scroll
I know this is a bad idea but it's what the client has asked for so....
i'm using mootools to override the window mouse wheel scroll event, so basically when the user scrolls the wheel i'm preventing ...
1
vote
1
answer
210
views
MooTools: How do I make an object capture a custom event occured in its nested object?
Here's the simplified code:
<html>
<head>
<script type="text/javascript">
var ParentDiv = new Class ({
initialize : function(htmlElement) {
...
1
vote
1
answer
251
views
bindWithEvent error while converting mooRainbow to mootools 1.4.4
I'm trying to get mooRainbow 1.2b ( http://moorainbow.woolly-sheep.net/ ) working with mootools 1.4.4 and I've run into an error that I can't seem to find an answer for.
The error is thrown in this ...
1
vote
1
answer
553
views
mootools disable or intercept an added event
let's say i do this:
$('field').addEvents ({
'focus' : function() { // do some stuff }
'blur' : function() { // do other stuff }
});
this is the default behaviour for all my text input fields. ...
1
vote
1
answer
1k
views
Mootools 1.2.4 delegation not working in IE8...?
So I have a listbox next to a form. When the user clicks an option in the select box, I make a request for the related data, returned in a JSON object, which gets put into the form elements. When the ...
1
vote
0
answers
122
views
How to get a Mootools event on an element passed to mako by cherrypy to work?
So I have in index.py:
class Test:
@cherrypy.expose
def index(self):
return mylookup.get_template('test.html').render(item="<div id='blah'>test</div>")
And in test.html:
...
0
votes
3
answers
1k
views
How to trigger event on dynamically generated elements (in mootools)
Example to demonstrate the issue can be found here:
http://jsfiddle.net/Byyu2/
As you can see only the first "Add" button triggers an event. The dynamically generated button does not. This is ...
0
votes
1
answer
2k
views
Emulate domready event with a custom event (mootools)
I need to fire a one time only custom event that functions like the domready event, in that if new events are added after the event has occurred they are fired immediately.
This is for some code that ...
0
votes
1
answer
238
views
Why is event in Firefox undefined when defining a pseudo event with MooTools?
I am trying to define a pseudo event with MooTools. It works in Chromium, but not in Firefox. Both browser are the newest stable version.
Here is my event:
DOMEvent.definePseudo('ctrl', function(...
0
votes
1
answer
125
views
Can someone explain jQuery's addEvents feature?
I saw this code on someone else's website, but found no reference to it on jQuery's site.
window.addEvents({
'domready': resizer,
'resize': resizer
});
Can either: someone point me to the ...
0
votes
1
answer
155
views
Mootools. New element with events in loop
I can't find the problem. May be you can help me:
load_images: function(config, container, page) {
console.log(page) // Every time page = 4 Why?
var paging = new Element('div','class':'pg'})....
0
votes
1
answer
259
views
scope of 'this' inside mootools class
I'm trying to define a click handler in a Mootools class. My handler presumes opening a block of links, each of which should be 'equipped' with its own click handler, which should trigger a link ...
0
votes
2
answers
200
views
run mootools function on each element except the one
I have two maps:
var map1 = document.id('map1');
var map2 = document.id('map2');
The second map is hidden.
map2.setStyle('display','none');
On the first map there is an element (link) that has an ...
0
votes
1
answer
61
views
Reference an accordion instance in Mootools
I'm using a CMS (Joomla 3) to show an accordion. Beyond the default functionality, I wish to put a button on each pane of the accordion to step to the next pane. Normally this would be done at the ...
0
votes
2
answers
483
views
Triggering JSON request from 'click' event in a selector box using Mootools
Im trying to trigger an asynchronous JSON request when I select an option from an HTML selector box using mootools.
I have the following form element:
<form method="post" id="sel">
<select ...
0
votes
1
answer
163
views
Where does Event.Keys gone?
Did I miss something or the Event.Keys object has gone from mootools since 1.4.0 ?
I cannot get the real value of a key or compare it to the current pressed key :
var modifiers = {
previous: ...
0
votes
1
answer
373
views
Dynamic change of the class of an HTML element not working effectively
I've written an HTML page that contains a form. The form is checked by a PHP page by having at the beginning of the HTML page :
<script type="text/javascript" src="js/mootools/core.js"></...