each

Scope of jQuery each() function?

Hey all, I'm working with the jQuery ColorPicker widget - specifically exercising the ColorPickerSetColor function (just 'setColor' internally). Code excerpt: setColor: function(col) { if (typeof col == 'string') { col = HexToHSB(col); } else if (col.r != undefined && col.g != undefined && col.b != undefined) { col = R...

Jquery select div in a row

Hiya all, I'm really stuck .. I need urgent advice :D here is my html : <!-- Beginning of ROW !--> <div id="row1"> <div id="entry"> free <span>some text</span> <p>DKK</p> <input type="radio" name="red<% Response.Write(counter); %>" id="radio" value="0" /> </div> <div id="entry"> week <span></span> <p>DKK</p> <input t...

Parse JSON array with jQuery .each()

Hi All! I have this jQuery function function getData(jsonLink){ $(".scrollable .items").html("<img class='loadGif' src='/sites/all/themes/zen/journeyon/images/ajax-loader.gif' alt='' />"); $.ajaxSetup({ url: jsonLink, global: false, type: "GET" }); $.ajax({ url: jsonLink, success: function(data) { var...

Jquery $this or each() to specify one link at a time

Im finding jQuery to difficult to learn as there seems to be many ways to write the same thing. As an exercise I would like to take the text within anchor tags and stuff it into the links href attribute. eg <a href="">http://www.something.com&lt;/a&gt; to become <a href="http://www.something.com"&gt;http://www.something.com&lt;/a&g...

Jquery using wrapAll

I need to find all the p tags inside all the divs with a class of someClass and wrap them with another div. This is how the beginning mark up would look like : <div class="someClass"> // Lots of different tags generated by the site <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> </div> <div class="som...

How to parse JSON array in jQuery?

EDIT I checked the jQuery documentation and using $.ajax with the json datatype specified returns an evaluated javascript object, so eval() isn't the answer here. I knew that anyway, since I am able to parse single JSON objects, just not arrays. The problem is the $.each-ing my way through them :) I have followed the syntax for parsin...

iterate through nested form elements in jquery

Hi! im sorry if this was posted already i have been looking to no avail.. I just want to know how to loop through nested form 'elements' (elements being not only the strict form elements like input tags but other html elements as well) in jquery. Currently i have this piece of code to do it: $('#'+arguments[i].formid).children().each(...

Find and disable fields of a certain name or ID using jQuery

I have a number of input fields that I would like to enable or disable based on the state of a checkbox. Specifically, any fields with IDs beginning with "ship1" I would like to find and disable them when the box is checked. Anyone know how? Here's a snippet of my page: <div id="tabs-1"> <fieldset> <legend>Ship...

Using show hide individually on a series of images within one div

I'm a total noob to JQuery, and I've been tasked with finishing a project beyond my ability. I've got a series of images each in it's own div with an associated hidden paragraph. I can use simple show/hide script to get the paragraph from the first div to show and hide properly, but once I add more image divs to the mix, the code eit...

Ajax Call inside a each() Loop not being asynchronous

Hi What I'm trying to do involves going through a series of checkboxes. For each one of them that it is checked, I have to perform some calculations (using an ajax call). If there is an error, I have to break the loop and return a message. Every ajax call takes about 0,4 seconds to perform but that shall never be a problem because I c...

Javascript: Open 1+ links (that dont have content)

HI, This makes no sense, but for example if i downloaded a file to your /Downloads folder and i wanted to run file:///.../Downloads/myfile1.txt i could just go: window.location = "file:///.../Downloads/myfile1.txt; But if i had say 10, or it was generated by a script.. how could i do effectively this.. open ...myfile1.txt => ...myfile...

jQuery1.3.2 change multiple same name class only use css(name, value) method. don't use css(name)

looking at the snippet. If you want to use jQuery css method change class LabelHeader both IE and FF, you only use each mehtod + css(name,value). $("document").ready(function() { var cssObj = { 'width': '500px', 'height': '460px' } var cssLabelHeader = { '...

jquery animation done

Ok so I have a tab class that is scrollable which works fine, but now I want to hide the controls if they cannot scroll in the direction that they are trying to go. so I have something like this; function tab_left(){ $(".tab_link").each(function(){ //animation here }); } Then I want to create a function that will make sure tha...

jQuery each function html list, just return object

Hello I have a bit of problem with my function who just should return html code function contentStringHtml(data, name) { return '<div id="gm-event-title">' + '<h2>' + name + '</h2>' + '</div>' + '<div class=\"gm-trafic-index\"><ul>' + $.each(data.DataTime, function(i, item) { r...

show data with delay from jquery each loop

Hello, My question is the following: What is the best way for looping some json array too show some data with like a one second delay. The one below does not work, because it only shows one message once instead of 4 jQuery.each(data.user, function(index, itemData) { timerid = setTimeout(function(){showMessage(itemData);}, 100...

this[0].innerHTML is undefined on JQuery Each?

Hey there! Sorry, but for some reason my call to each() always fails, and "this[0].innerHTML is undefined" shows up in fire bug. The code isn't particularly complicated and it seems to follow all the examples I've seen so far. Would anybody have an idea as to why this would fail? $("#theirItems tbody tr").each(function(i){ var ...

Javascript: Each Array

Note: No jQuery How could i do something like this: var array = new Array(); array[name] = "Tom"; array[age] = 15; foreach(array as key=>value){ alert(key + " = " + value); } ...

ruby - if string is not contained within an array

I only want to output one anchor here. If the current_page is in the array I get two (.html and -nf.html). If it is not in the array I get as many anchors as there are items in the array. I am using StaticMatic. - if page_options[:current_index] < page_options[:total_index] && page_options[:current_index] > 0 // loop through the ...

JavaScript: Variable Value gets lost between functions

I have the following code function updateSliderContent(json) { //<- json defined here is correct var screen_order = json.screen_order.split('_'); jQuery.each(screen_order, function(i, item) { var screen_id = item; //at this point it is not, thus the function does not execute whatever is in the if blocks if (json...

jQuery .each problem

Brain squeeze and need help, I have a table with 6 rows that are that can be hidden or visible depending on if a check box is checked. This .each routine works great with one small problem - when the last check box (val="5") is checked and you hit the refresh button the row 6 (with class="hide5") is hidden. This only occurs on the last ...