prototype

Autosizing Textarea

I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address. Now I think it would look much nicer, if the textarea I'm using for the main address details would just take up the area of the text in it, and automatically resize if the text was c...

How to Maintain Correct Javascript Event After Using cloneNode(true)

I have a form element that contains multiple lines of inputs. Think of each line as attributes of a new object that I want to create in my web application. And, I want to be able to create multiple new objects in one HTTP POST. I'm using Javascript's built-in cloneNode(true) method to clone each line. The problem is that each input-lin...

jQuery and Prototype Selector Madness

Both the jQuery and Prototpye JavaScript libraries refuse to allow me to use a variable to select an list item element by index number although they accept a hard coded number. For example, in Prototype this works: $$('li')[5].addClassName('active'); But this will not work no matter how I try to cast the variable as a number or inte...

"undefined handler" from prototype.js line 3877

A very niche problem: I sometimes (30% of the time) get an 'undefined handler' javascript error on line 3877 of the prototype.js library (version 1.6.0.2 from google: http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js). Now on this page I have a Google Map and I use the Prototype Window library. The problem occurs in ...

Binding custom functions to DOM events in prototype?

Jquery has a great language construct that looks like this: $(document).ready(function() { $("a").click(function() { alert("Hello world!"); }); }); As you might guess this, once the document has loaded, binds a custom function to the onClick event of all a tags. The question is, how can I achieve this same kind of beh...

How can I highlight a table row using Prototype?

How can I use the Prototype library and create unobtrusive javascript to inject the onmouseover and onmouseout events to each row, rather than putting the javascript in each table row tag? An answer utilizing the Prototype library (instead of mootools, jQuery, etc) would be most helpful. ...

How would you go about for switching a site from Prototype to jQuery

I have written a site in Prototype but want to switch to jQuery. Any ideas on how best make the switch? ...

How do I get an XML file as XML (and not a string) with Ajax in Prototype.js?

This code is from Prototype.js. I've looked at probably 20 different tutorials, and I can't figure out why this is not working. The response I get is null. new Ajax.Request( /path/to/xml/file.xml, { method: "get", contentType: "application/xml", onSuccess: function( transport ) { alert( transport.responseXML ); } })...

Looking for in-depth comparison of selectors and events for jQuery and Prototype

A few of the third-party applications we use are written in Prototype, and I'm really having trouble with selectors and events. I know how to accomplish it all in jQuery quickly, but I'm not about to load both libraries. Can you provide a few links that do a top-down comparison of selectors and/or events for jQuery and Prototype, so I ca...

What are the best strategies for using multiple AJAX libraries?

What experience can you share about using multiple AJAX libraries? There are useful features in Prototype, some in jQuery, the Yahoo library, etc. Is it possible to include all libraries and use what you want from each, do they generally all play nicely together with name spaces, etc. For the sake of speed is there a practical limit to ...

Scriptaculous Ajax.Autocompleter extra functionality in LI

I'm using the Ajax.Autocompleter class from the Prototype/Scriptaculous library which calls an ASP.NET WebHandler which creates an unordered list with list items that contain suggestions. Now I'm working on a page where you can add suggestions to a 'stop words' table, which means that if they occur in the table, they won't be suggested ...

Problem accessing the content of a div when that content came from an Ajax call

Here's a very simple Prototype example. All it does is, on window load, an ajax call which sticks some html into a div. <html> <head> <script type="text/javascript" src="scriptaculous/lib/prototype.js"></script> <script type="text/javascript"> Event.observe(window, 'load', function(){ new...

Quick C# prototype program with simple DB

Okay, I've seen but haven't programmed in C# before. You can assume I'm competent in C++, and advanced in C (for what good that'll do me). I understand inheritance, polymorphism, etc so OO concepts aren't going to be a huge problem. Let's say I've been given a task to prototype a quick and dirty program that won't be much different th...

Prototype's Enumerable#pluck in F#?

In JavaScript, using the Prototype library, the following functional construction is possible: var words = ["aqueous", "strength", "hated", "sesquicentennial", "area"]; words.pluck('length'); //-> [7, 8, 5, 16, 4] Note that this example code is equivalent to words.map( function(word) { return word.length; } ); I wondered if somethi...

How can I reimplement external pop-up jQuery code in Prototype?

I have this code in jQuery, that I want to reimplement with the prototype library. // make external links open in popups // this will apply a window.open() behaviour to all anchor links // the not() functions filter iteratively filter out http://www.foo.com // and http://foo.com so they don't trigger off the pop-ups jQuery("a[href='ht...

Debounce clicks when submitting a web form

A poorly-written back-end system we interface with is having trouble with handling the load we're producing. While they fix their load problems, we're trying to reduce any additional load we're generating, one of which is that the back-end system continues to try and service a form submission even if another submission has come from the ...

Scriptaculous not working with the latest Prototype.

This is a really weird problem that I have been having. When I download Scriptaculous from the official web site, script.aculo.us, bundled in the ZIP is prototype.js version 1.6.0.1. This works perfectly fine, I can follow along the wiki examples and begin learning. However, when I upgrade to prototype 1.6.0.2 (the latest version) from p...

Prototype get by tag function

How do I get an element or elementlist by it's tag name. Take for example that I want all elements from ...

How do I select all <th> elements of class "sortasc" within a table with a specific id?

Let's say I have the following HTML: <table id="foo"> <th class="sortasc">Header</th> </table> <table id="bar"> <th class="sortasc">Header</th> </table> I know that I can do the following to get all of the th elements that have class="sortasc" $$('th.sortasc').each() However that gives me the th elements from both table foo an...

Adding an input field to the dom and focusing it in IE

I am trying to make a div, that when you click it turns into an input box, and focuses it. I am using prototype to achieve this. This works in both Chrome and Firefox, but not in IE. IE refuses to focus the newly added input field, even if I set a 1 second timeout. Basically the code works like this: var viewElement = new Element("div"...