javascript

JQuery: My 'scroll' event is CRAZY slow. What am I doing wrong?

I have 4 DIV that I want to have a scroll event fired when you scroll on one of those div's. This is the code below. $('#div1, #div2, #div3, #div4').scroll(function() { alert('...'); }); In Firefox/Chrome, this runs fast; however, in Internet Explorer this runs so slow that it actually prevents me from scrolling the div. I'm usin...

Problem with jQuery Mouseenter/Mouseleave in Firefox

I'm having a problem with the mosueenter/mouseleave events only in Firefox... http://www.screencast.com/users/StanleyGoldman/folders/Jing/media/be3572de-9c72-4e2a-8ead-6d29b0764709 <HTML> <HEAD> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.js"&gt;&lt;/script&gt; <script> $(docume...

Running javascript code after DOM has been updated from previous code

I'm pulling in a google news feed, then trying to take out some mal-formatting by accessing the newly-created DOM elements. var aryClassElements = document.getElementById('google-news').getElementsByTagName('div'); alert("Found "+aryClassElements.length+" divs in Google News"); But this alert shows 0. It hasn't found the newly-create...

Please help me fix this Jquery function and figure out a fallback in case Javascript is disabled.

This code is supposed to get the id from a clicked anchor tag in the middle of a ul with the id 'links' and then use that id for other purposes across the page, however the alerts have shown me that I keep getting 'undefined' as if the element has no id. I double check my source code and they do indeed have ids, so I'm not sure what the...

Parsing ATOM feed in Dojo?

I am trying to parse an ATOM feed and display the relevant parts I need. After doing some searching, I couldn't find a way to do this in Dojo, so I wrote this implementation to get by in the meantime (var xml contains the atom feed): var names = this.getArray(xml.getElementsByTagName("name")); var contents = this.getArray(xml.getElement...

Has PastryKit been successfully implemented by anyone other than Apple?

Has PastryKit been successfully implemented by anyone other than Apple? This article and others give a detailed breakdown and source code of PastryKit but has anyone actually got their own content into this framework? http://davidbcalhoun.com/2009/pastrykit-digging-into-an-apple-pie ...

where to include script files

i have divided various components of the page in different php file. In the navigation php file i have the objects i want to use in the javascript. where should i put the javascript <script ...> so that it loads fine? right now i am putting it in a completely seperate file header.php? but i dont think the javascript is picking objects fr...

Is there a way to see a trace of the executed JavaScript in Firefox without using Firebug?

Update: Thanks for the responses so far. To clarify, I'm not really looking for a logger, but more of a debugger/tracer -- I want a dump of every piece of JavaScript that executed and when it executed. I tried Venkman earlier today but it isn't very stable. My theory is that something is going wrong deep in the Dojo code, or even the Fir...

Setting the value of a dynamically created text box with jQuery

Using the following code var newDiv = $(document.createElement("div")); var newTextBox; newTextBox = $(document.createElement("input")) .attr("type", "text") .attr("id", "textbox") .attr("name", "textbox"); newTextBox.val("text"); newDiv.append(newTextBox); alert(newDiv.html()); I get the following <input name="textbox"...

Fire Javascript Event When a DIV is in View

Is it possible to fire a specific javascript event when a certain DIV comes into view on the page? Say, for example, I have a very large page, like 2500x2500 and I have a 40x40 div that sits at position 1980x1250. The div is not necessarily manually positioned, it could be there due to the content pushing it there. Now, is it possible ...

jQuery each width problem

I have the following function set to run on a hover over an image: function() { $('.slides .slide h3').each(function(i){ var owidth = $(this).width() $(this).animate({"right":730 - owidth - 16}, 500); }); } You can view the page here. Over the image and click the next icon on the lower right of the image. For some reason,...

jQuery/JavaScript issues in Safari PC/Mac

Hey, I am almost finished a contract right now, and it appears at the last minute that most of my javascript/jQuery isnt working in Safari on either PC or Mac. The whole site is designed with progressive enhancement and unobtrusive javascript to turn ?p= links into # hash links, fade pages in and out, and have smooth rollovers - all of...

How Do I replace all Occurrences of / with _ in JavaScript?

For some reason the "".replace() method only replaces the first occurrence and not the others. Any ideas? ...

How do I have something happen *after* the scriptaculous highlight effect

render :update do |page| page.visual_effect :highlight, row_id, :duration => 20, :startcolor => "#FFCC33", :restorecolor =>"" page << "alert('hi');" end In the above code, I have a highlight effect that occurs and lasts for 20 seconds, after the highlight effect completes, I want to have an alert popup. Currently, the alert immedia...

JQuery: selector performance

I have the following HTML: ... <div id="panel"> <div class="abc"> <p class="xyz">Hello</p> </div> </div> ... Question: What's the fastest way with JQuery for me to access the p.xyz element? I've read some performance reviews but they don't account for all different scenarios. I could do the following, but don't know h...

What ExtJS 3 pitfalls should I avoid?

I am about to write a relative small data entry application using ExtJS 3+ for the front end, what pitfalls should I avoid when using ExtJS 3+? One pitfall that comes to mind is not truly understanding JavaScript (e.g.closures) Trying to use MVC pattern on the client side. ...

How do jQuery modal box plugins compare?

There is a huge number of jQuery modal box plugins out there. Jitter lists 20 of them in this response (http://stackoverflow.com/questions/1656086/modal-windows-plugin-to-rails#1656105). Which one do you use and why? If you use different ones in different cases, how can they be broken down categorically by use-case? ...

How do I do a deferred response from a node.js express action handler?

Using Express (for node.js) How do I write a response after a callback? The following is a minimal example. posix.cat is a function that returns a promise, up does something to the result, and I want to send that as the response. require.paths.unshift('lib'); require('express'); var posix = require('posix'); get('/', function () { ...

How can I associate a live event with an index selector using jQuery?

I have the following HTML: <ul id="tabs"> <li><a href="...">One</a></li> <li><a href="...">Two</a></li> <li><a href="...">Three</a></li> </ul> I want to perform a unique action when someone clicks on each of the links. I tried the following and it did not work $("#tabs li").eq(1).live('click',function(){alert('ONE....');...

nested html FORM is inaccessible - multiple forms problem

Here is the scenario, I have 3 html forms on a page and they look like form1() form2(form3()) a dummy program to test out the 3 forms __ <script language="javascript" type="text/javascript"> function submitthisform(no){ document.forms[no].submit; } </script> <form action="http://cnn.com" name="1"> <input type=submit value="c...