In prototype the cumbersome for:
for (i=0; i<10; i++) { ... }
can be written as
$R(0, 10).each(function(i){ ... });
Is there an equivalent of range in JQuery ?
I am developing some JavaScript that should work with either Prototype.js or JQuery, thus I need some way to identify what is the primary library in use. How can I do that?
I am working on Ruby on Rails application, with Prototype.
I want to display a loading div automatically with every ajax request and hide it on completion, without writing code for every ajax request in my application.
Is there anyway to do this.
<div id="loader">Loading...</div>
Prior to submitting a form, I would like to check if a file has been attached and pop up a warning message saying that a file needs to be attached if it hasn't been. I was wondering how to accomplish this using JavaScript or Prototype or JQuery etc?
Hi..I recently bumped into this link
http://mootools.net/slickspeed/
I was amazed to see that the prototype is extremely slow. So I would like to know your comments on this?
Dear experts,
Pardon me for giving you a confusing title on this problem.
I'm really confused and i don't know how to put it in other words.
So here is what I what to accomplish.
I am making a Custom Javascript Object to store data.
I have automated this process and inserted each instance of the object into an array.
I am making a loop…
Hi,
I would like to update the following javascript code based on Prototype framework to jQuery framework:
Event.observe(window, 'load', function() {
$$('.piece').each(function(item) {
new Draggable(item, { revert: true } );
});
$$('.cell').each(function(item) {
Droppables.add(item, {
accept: 'piece',
onDrop:…
I am trying to grab the current value of a drop down list with Prototype and passing it along using :with like this
<%= link_to_remote "today", :update => "choices",
:url => { :action => "check_availability" } ,
:with => "'practitioner='+$F('practitioner')&'clinic='+$F('clinic')&'when=today'",
…
I have a series of functions with the same prototype, say
int func1(int a, int b) {
// ...
}
int func2(int a, int b) {
// ...
}
// ...
Now, I want to simplify their definition and declaration. Of course I could use a macro like that:
#define SP_FUNC(name) int name(int a, int b)
But I'd like to keep it in C, so I tried…
When I try to call "Test" function I get an error.
How to fix that? (no jquery!)
Browser:firefox
error:
TypeError: this.Test is not a function
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script…
I have this JSON (which validates according to JSONLint):
[
{
"BugCount":"2",
"BugTitle":"C:\\INETPUB\\WWWROOT\\CLUBREADY2\\TRAINERS\\../Connections/LTC.asp",
"ErrLine":"141",
"BugID":"702"
},
{
"BugCount":"1",
"BugTitle":"/admin/ajax_logagreementsig.asp",
"ErrLine":"0",
"BugID":"1322"
},
]
…
Hi,
I have a number of elements that i want to loop through as groups. Consider this HTML:
<input class="matching match-1" />
<input class="matching match-1" />
<input class="matching match-2" />
<input class="matching match-2" />
<input class="matching match-2" />
<input class="matching…
Is there a CSS selector for the last occurrence of a class on a page?
Say i have this HTML
<dd>
<span>
<a class="required" id="forename">foo</a>
</span>
</dd>
<dd>
<span>
<a class="required" id="surname">bar</a>
</span>…
I've built a form to upload images, and processed with Prototype/PHP.
$('image_upload').observe('submit', function() {
var params = $H();
params.set('name', $('image_title').value);
params.set('from', $('from_who').value);
params.set('upload_file', $('upload_file').value);
new…
How would I achieve something along the lines of this..
var Persistence = new Lawnchair('name');
Object.extend(Lawnchair.prototype, {
UserDefaults: {
setup: function(callback) {
// "save" is a native Lawnchair function that doesnt
//work because
…
So it looks like on RoR, when Ajax (using form_remote_tag) returns a success code, Javascript is also returned to handle the visual effects. (this is the RJS mechanism)
using Fiddler, I do see the following response:
try {
Element.update("vote_score", "Score 58");…
I'm using prototype.js for my web app, and I have everything running on chrome, safari, and firefox. I am now working on IE8 compatibility.
As I've been debugging in IE, I've noticed that there are javascript events for which I have previously set an observer on…
Hi all.
I've got a hidden form field, and when a button gets pressed the value of the hidden field is changed. Now, I've added an observer to the hidden field, listening for changes to occur. For some reason, though, the event listener never kicks in, even though…
I'm implementing a Web service that returns a JSON-encoded payload. If the service call fails -- say, due to invalid parameters -- a JSON-encoded error is returned. I'm unsure, however, what HTTP status code should be returned in that situation.
On one hand,…
When an user tries to send AJAX requests simultaneously from multiple browser tabs, the earlier requests get completed and the page loads but the other AJAX calls are preempted. AS a result of which the response is empty for the other calls. Only one call…
I'm having an encoding issue, and I'm not sure where to look for the problem.
I have this Ajax.Request function (prototype library) sending data to a Groovy/Grails encoder
var myAjax = new Ajax.Request(url, {method:'post', encoding:'UTF-8',…
The prototype for setsockopt is:
int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
Are the following all correct ? Which are not ?
a.)
int buffsize = 50000;
setsockopt(s, SOL_SOCKET,…
I want to use auto-completion in a number of fields (5-7) in my forms. There is a screencast on auto-completion with Prototype library by Ryan Bates ( http://railscasts.com/episodes/102-auto-complete-association). On the other hand, I have…
Our webapp has a form with fields and values that change depending on values entered. Each time there is a change event on one of the form elements, we use an expensive AJAX call to update other elements on the page.
This works great for…
Suppose I have a page located at www.example.com/foo, and it contains an iframe with src="http://www.example.com/bar". I want to be able to fire an event from /bar and have it be heard by /foo. Using the Prototype library, I've tried…