javascript

jquery click event is overridden when new object is created

I am writing an Ajax application which uses a callback function to add a card to a players hand. the object is created correctly and the menu for each object is also created correctly. when created the DOM object, in the callback function i use to add the object, i have some code like this: $("#card"+cardNum).live('click',function(){ ...

JavaScript equality between objects and strings

According to Firebug console, we have the following in JavaScript: >>> [''] == '' true >>> [''] == [''] false Finding Python to be much more logical here, I'd expect it to be the way round. Anyway, I can understand the second one — apparently two different objects never compare equal to each other, — but what is the reason for the fi...

Finding the web address of a Javascript link

Hi all, I am using RCurl in R to try and download data from a website, but I'm having trouble finding out what URL to use. Here is the site: http://www.invescopowershares.com/products/holdings.aspx?ticker=PGX See how in the upper right, above the displayed sheet, there's a link to download the data as a .csv file? I was wondering ...

Problem with IE and setInterval() not refreshing/updating.

Hello. I'm using JavaScript/Jquery to make a page auto-update with a value from a database, although it doesn't seem to update in Internet Explorer. It works fine in FireFox & Chrome. Can anyone explain what's wrong? It looks like IE is just displaying a cached version of the page. How can I prevent this happening? Thanks. function upda...

Multiple periodically_call_remote calls not behaving as expected

I've been doing ruby and rails for a long time but am a newbie when it comes to the more dynamic elements (currently jrails and jQuery), so it's entirely possible I'm missing something. That said, I've got a page where multiple elements need updating from multiple sources. For example, a dynamic header comes from one source and 5-6 d...

Add another series to existing plot with flot

I need to know how I can easily add another series to an existing plot using Flot. Here is how I currently plot a single series: function sendQuery(){ var host_name = $('#hostNameInput').val(); var objectName = $('#objectNameSelect option:selected').text(); var instanceName = $('#instanceNameSelect option:selected').text(); var counterN...

Is there a good way to remotely get javascript debug information from an end-user?

I've been trying to solve a Javascript problem on my company's site that a single user has reported, but have exhausted all possible fixes I can think of. To do more, I'll need more information about what's happening in the user's browser. Can anyone suggest a bookmarklet or other tool I can send to this user to print a log of all Ajax...

How can I supress Jquery Autocomplete's menu opening on search?

I've got an Autocomplete input that is a filter to a datatable. When the person searches in the box, autocomplete does it's job and attached to the source callback, it does an ajax lookup and triggers an update to the table. Additionally it updates a div mentioning how many suggested results were returned. I've also got a "suggest" butt...

Three Dots jQuery on ajax load

I am using the ThreeDots jQuery pulgin and it works great. I am having trouble using it on an ajax success event. $.ajax({ type: "POST", url: 'url', success: function(value) { $("#content").append(value); $(".ellipsis").ThreeDots({max_rows:3}); } }); I load some new data and append the new data to a di...

how to check the parent window

I am having a problem getting to the parent window. I have a window that has 2 frames...one of the frame opens another window which in returns open a third window. In the third window I want to refresh the very first window by doing this window.opener.window.opener.close(); it only works for non frame setup...what can I use for the fr...

"Make this page your Startpage" script (JavaScript)

Hi guys I have Googled for a JavaScript that sets the current page to your startpage. But all I can find is some old script for IE 5 and up. <FORM> <INPUT TYPE="button" VALUE="Make This Site Your Home Page" onClick="this.style.behavior='url(#default#homepage)'; this.setHomePage('Page URL beginning with http:// here');"> </FORM> The...

Why is JavaScript inconsistent across browsers?

Here's something I've been pondering after countless hours fixing JS to be cross-browser compatible (mostly IE): Why isn't Javascript consistent accross browsers? I mean, why can't JS be nice like Java and Flash? Instead, we have to resort to frameworks like jQuery. Don't get me wrong, they make my life easier - but why do they even exi...

Get element Attributes using jQuery

following is my HTML HTML : <div Attr1 = "val1" Attr2 = "val2" Attr3 = "val3" > Hello !! </div> I want to extract all the attributes (& its corresponding values) of an element. How can I do this using jQuery? I tried something like below, $(function() { for(var i in $('div')[0].attributes) { console.log($('div')[0]....

Javascript: Checking if an object has no properties or if a map/associative-array is empty

Possible Duplicate: How do I test for an empty Javascript object from JSON? Is there an easy way to check if an object has no properties, in Javascript? Or in other words, an easy way to check if a map/associative array is empty? For example, let's say you had the following: var nothingHere = {}; var somethingHere = {foo: "ba...

Dynamically added JavaScript overwrite the html page view (not the code)

Hi everybody! My problem was that I wanted to add JavaScript into a html page, thanks to Andy E, I find the way to add my JavaScript into a html page and be executed. But now my problem is that all the page is overwritten by the JavaScript. Someone know how to do the same thing but without overwritten the page with the JavaScript, somet...

How to get first character of string?

I have a string, and I need to get its first character. var x = 'somestring' alert(x[0]); //in ie7 returns undefined How can I fix my code? ...

Inter-component communication in javascript

I have a need for inter-component communication in a web application and am considering different ways to accomplish this. I have some ideas, but would welcome other ideas. First, a quick and simple example. I have two separate components on a page that are loaded asynchronously. By component, I mean a chunk of HTML that has a javascrip...

How do I persuade JqGrid columnChooser to use the correct interface?

On the demo website for jqGrid, the columnChooser module is displayed like this: It allows you to both reorder the columns and select which columns are to be shown. Unfortunately when I enter this section of code into my application(The code that is suppose to make this appear exactly as portrayed): jQuery("#colch").jqGrid('navButto...

find firebug XUL window

I want to get handle of firebug XUL window, and do some operations such as toggle, reopen, close and issue these actions from main window, using javascript. I hope my question is clear enough to understand. Where firebug.xul definition starts like this: <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" ...

Need help with this fancybox form submit

Hello, I am using fancybox to open submitted form like this.... <form name="form" id="myForm" action="{$smarty.server.PHP_SELF}?action=abc" method="post" target="iframe" onsubmit="document.getElementById('iframe').src='{$smarty.server.PHP_SELF}?action=abc';"> <input type="hidden" name="xyz" value="123"> <input type="submit" value="...