javascript

jQuery targeting correct radio button is unresponsive

I have a javascript array containing the name and values of radios I want checked. jQuery(window).load(function(){ var selected_options = new Array(); selected_options['swing_type'] = 'Slide'; var x; for (x in selected_options){ jQuery("#menu input[name="+ x +"][value="+ selected_options[x] +"]").attr('checked', 'check...

What is the space complexity of HashTable, Array, ArrayList, LinkedList etc(if anything more)

I want to know the space complexities of the basic data structures in popular languages. ...

Need help: unable to get Dexagogo's validation plugin to work in a Rails app

I am trying to use Dexagogo's validation plugin to validate a form in a rails app but unable to get it to work. I have a form like this: http://www.pastie.org/1016183 Its a Rails 2.3.5, Prototype: 1.6.0.3 and Dexagogo's validation plugin: 1.5.4.1 ...

Why is my Facebook Connect button taking me to the wrong URL?

I'm trying to link my website with Facebook. If I call the method in the PHP SDK called getLoginUrl(), it returns the correct login URL. This URL contains a number of parameters, one of which is my API key and it is correct. This is the URL that my Connect button is supposed to take me to. However, when I actually click the Connect but...

Problem with the position of the loading image.

I have a loading image in the page which is appended as child to one particular <div id="event_list">. This "event_list" <div> is a child of map <div>. At the initial position the loading image is coming correctly, but when I change the map <div>'s position as to absolute the loading image is not correctly coming. I may not be clear in e...

Self executing function and the document.write

Hi, I have this self-executing function: <script type="text/javascript"> (function() { var sc = document.createElement('script'); sc.src = 'http://blahblah.com/test.js'; sc.type = 'text/javascript'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sc, s); })(); </script> All that is conta...

what does this mean: var _gaq = _gaq || [];

Possible Duplicates: In Javascript, what does it mean when there is a logical operator in a variable declaration? whats the javascript var _gaq = _gaq || []; for ? what does this javascript syntax mean? var _gaq = _gaq || []; ...

Which jQuery code is more efficient?

Hello All - Out of curiousty which of the following code is more efficient (if neither, what would be the best way?) Backstory - Building a small image carousel and the code in question has to do with the controls (prev, pause/play, next) <ul class="controls"> <li> <a href="#" class="prev"> Previous Image </a> </li> <li> <a h...

JavaScript Starter Framework Errors

Hi, I am trying to learn more about JavaScript and I am messing around with... stuff. Could someone tell me why I am getting errors in my script please. // Effects object var effects = { // Display an object show : function(obj) { obj.style.display = 'block'; }, // Hide an object hide : function(obj) { obj.style.display = 'hid...

Using jQuery, how do I detect which <input type='image> was clicked in a form with multiple submit images?

Let's say we have this form: <form> <input type="text" name="some_name" value="val" id="some_name"> <input type="image" value="action" alt="Add To Cart" name="add" src="/images/submit.gif"> <input type="image" value="action" alt="Shop some more" name="return" src="/continue_shopping.gif"> </form> How do I find the input that sub...

Is it possible to hide a value in a form drop down list (PHP, JavaScript)?

Hi all, I have a form drop down box (for the 50 states) that is populated via a PHP for loop (see code below). The user selects a residential state, then later in the form also has to select a mailing state (in case the two are different). I have provided a check box in JavaScript that, when checked, populates all the mailing informati...

passing javascript object to function in a jquery way?

Yeah so I've been messing around with javascript a while but only recently got into stuff like object orientation, prototyping and using objects for all functions and vars. But, many frameworks like jQuery or extJS have something I have yet to grasp, you can define an object by using a built in function for searching the dom, example: ...

Prevent Galleriffic jquery plugin from reloading the same image twice

Is it possible to prevent the Gallerific plugin from reloading the same image that’s already showing? For instance, if a user clicks on the same thumbnail twice, the gallery image reloads. Can Galleriffic determine that the user is requesting the same image twice and thus should not reload until a new image is requested? ...

fit container height to layered content (to visible layer)

I have a div, the container and few other divs inside - the layers. Visibility of layers is switched dynamically with JavaScript. I want the container to fit its height to visible layer when switching between them, but also when we are zooming the page in or out. Generally I want to create a page that instantly loads all of its contents...

problems with jQuery load() method

I'm just starting with jQuery, and having trouble doing something embarrassingly simple: using .load() to insert external HTML into a main page. Here's the main page: <html> <head> <script src="js/jquery-latest.min.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> $...

javascript syntax and jQuery source

Possible Duplicate: For the function (function($){})(), Ive seen it with the word jQuery in it, why is that? Can someone explain the following syntax that is used in the jQuery source files? I am learning jQuery and trying to dive into writing a jquery.ui.widget. (function ($) { ... code ... } (jQuery)); While I am usin...

Is it possible to have a javascript function in php

Hi everyone, I have a program which records the time when user clicks the button I have written the timer script in javascript now i want to include this function inside php how can do this. Thank you, Swarna ...

HTTP request in Javascript

Should this code not work? I actually have no idea how to use this HTTP request thing. <script language="javascript"> function HTTPCALL() { var request = HTTP.newRequest(); request.open("POST", "https://workplace.intuit.com/db/main", false); request.setRequestHeader("Content-Type", "application/xml"); request.setRequestH...

jQuery Custom Autocomplete load with jQuery Validate

It may sound like a very minor issue. I have a voting system with many text fields where survey taker enters the name. Each of the input box has been initialized with autocomplete. There's also jQuery Validates running on the form where I have to use .addMethod to validates them dynamically base on the sibling input fields. The follo...

How to check if an appended <img /> src attribute is relative or absolute using jQuery & IE7?

I have a website that includes code: <html> <head> </head> <body> <div id="wrap"> <img id="img_1" src="images/sample.gif" alt="Image 1" width="200" height="40" /> </div> </body> </html> I have this JavaScript and jQuery: $(document).ready(function(){ $('#wrap').append('<img id="img_2" src="images/sample_2.gif" alt...