[jQuery] each, index to addClass

2009-12-01 Thread yskel
New to jQuery, and I have a problem that I suspect has a really simple solution: For a set of elements matching $(a.CustomClass), how do I add a class to each element based on that element's index? For instance my document contains: test test test I'd like to run the jQuery script to end up wi

[jQuery] Re: jquery each function iterate through form inputs problem

2009-10-24 Thread Mike Alsup
> $('#formid>input').each(function(){ >         if($(this).attr('id')!='') alert($(this).attr('value'); //fetch id if > not blank ang show value > > }); > > the code inside this function does not run if the form is rendered > this way: > > >   >           >         >   > > > but if it is rend

[jQuery] jquery each function iterate through form inputs problem

2009-10-24 Thread jan
Hi! I cant get this each function to work inside a form: for example i have this code: $('#formid>input').each(function(){ if($(this).attr('id')!='') alert($(this).attr('value'); //fetch id if not blank ang show value }); the code inside this function does not run if the form is render

[jQuery] each function not iterating

2009-10-21 Thread j...@creatusadvertising.com
Hi! I have this code: $("form.uplform").live('submit', function(){ if($(this).attr('validate')=='true'){ $("#testform>input").each(function(){ alert($(this).attr('name'));

[jQuery] each function not iterating

2009-10-21 Thread jan
Hi! Sorry to flood please disregard my previous attemp to post for this same issue. This is the real post. I have this code within the ready function: $("form.uplform").live('submit', function(){ if($(this).attr('validate')=='true'){

[jQuery] Each function gives errors in IE6

2009-09-24 Thread Shane Riley
I've got a simple each function that finds every subnav and assigns it a vertical position equal to half of the subnav's height. This works great in all modern browsers, but in IE6 I get errors from each of the two lines within the function. Here's the problem function: $(".subnav").each(function

[jQuery] Each function gives errors in IE6

2009-09-24 Thread Shane Riley
I've got a simple each function that finds every subnav and assigns it a vertical position equal to half of the subnav's height. This works great in all modern browsers, but in IE6 I get errors from each of the two lines within the function. Here's the problem function: $(".subnav").each(function

[jQuery] each() needs documentation

2009-09-14 Thread Jānis
Hello! I could not find each() in jQuery's documentation. Could it be included there, please, as I was browsing all the features to find out what exactly is the collection of elements returned by the many JQuery functions and how to be able to access and manage each of them separately, but could

[jQuery] each() causing me jip :[

2009-09-06 Thread ldexterldesign
Hey guys, If you can help me with the fix (line: 9) below that would be great. each() is causing the problem for me, as it's performing the code on each and not the total 's. Can anyone suggest a solution? // create a 'continue reading' - linked to the single post page - if .scrollableItem's p

[jQuery] $.each cannot iterator my array

2009-08-28 Thread davidshe...@googlemail.com
Hi, i have an array initialized like var myArr = new Array(); later I use myArray['somestring'] = new Array(); myArray['somestring'].push(mydata); to create and new array inside of it, and populate my data by pushing. Then I want to use the jQuery.each(...) to iterator over it, like this $.ea

[jQuery] .each() loop with custom function

2009-08-16 Thread andrew.croce
Hi, I am pretty new to this so please excuse problems that might seem obvious...they're not necessarily obvious to me yet. I am writing some basic image gallery functionality, using my own defined jquery functions. I am trying to use .each() to loop through the "image" tags of an xml file, and cr

[jQuery] .each - how to write in my code?

2009-04-12 Thread adesign
Hello, I am very new to jQuery and don´t know how to write my code for every item. Here is my code for a list with hover functions, I would like for every item to be processed separately. I know about a functio that is written ".each", but can´t seem to get it to work. --- $(funct

[jQuery] .each()

2009-03-31 Thread iceangel89
i used .each to select all elements with id that starts with laLab $("*[id^=laLab]").each(function (i, obj) { alert(obj.attr("value")); }); but i cant do obj.attr("value") nor obj.val(). why is this so? when i alert(obj) its said i got HTML Input Element which is right

[jQuery] Re: jQuery each problem

2009-03-16 Thread macgyver47
I agree with you $(this).val() = 'yes'; means nothing $(this).val() == 'yes' or $(this).val() === 'yes' returned nothing var yes_or_no=jQuery(this).attr("value"); returned what I was looking for Thank you for great help Jean from France On 15 mar, 21:35, Josh Powell wrote: > Glad I could help.  

[jQuery] Re: jquery each help

2009-03-15 Thread Tom Shafer
Im getting the effects I want just not in the right order. I think im going the right way with each, im just not using it the right way. Any other thoughts? -TJ On Mar 15, 4:20 pm, Josh Powell wrote: > read up on the .animate() jQuery effect, this might be what you are > looking for. > > http:/

[jQuery] Re: jQuery each problem

2009-03-15 Thread Josh Powell
Glad I could help. That's an interesting thing you ran into, first, i assume that instead of $(this).val() = 'yes'; you meant $(this).val() == 'yes' or $(this).val() === 'yes' because the first one meant you are trying to store 'yes' in $ (this).val()... which wouldn't work anyway. Actually b

[jQuery] Re: jquery each help

2009-03-15 Thread Josh Powell
read up on the .animate() jQuery effect, this might be what you are looking for. http://docs.jquery.com/Effects/animate On Mar 15, 11:46 am, Tom Shafer wrote: > I have articles in a group of divs > >                         width="11" > height="211"/> >                         >            

[jQuery] jquery each help

2009-03-15 Thread Tom Shafer
I have articles in a group of divs POSTED: 15 MARCH 2008 1400 HOURS > SNEAK PREVIEW OF NO CHILD... Lorem ipsum dolor sit am

[jQuery] Re: jQuery each problem

2009-03-15 Thread macgyver47
What works is var yes_or_no=jQuery(this).attr("value"); if(yes_or_no=="yes"){ do something } else { do something else } Thanks for helping all the way to a fine solution On 15 mar, 15:10, macgyver47 wrote: > Unfortunatly it doesn't work > if ($(this).val() = 'yes') > returns nothing > $(this).v

[jQuery] Re: jQuery each problem

2009-03-15 Thread macgyver47
Unfortunatly it doesn't work if ($(this).val() = 'yes') returns nothing $(this).val() returns "on" no matter if you click on button Yes or button No I have been ckecking jquery doc the best I could and cannot find answer to my question: how to I know if user clicked on button Yes or button No Any

[jQuery] Re: jQuery each problem

2009-03-14 Thread Josh Powell
$(this).is("eq[0]") will not work because, is looks at the list of jquery objects that $ (this) returns. Which is just one object. try giving the input a value of yes or no and doing if ($(this).val() === 'yes') On Mar 14, 8:51 am, macgyver47 wrote: > One more question if this is not abusin

[jQuery] Re: jQuery each problem

2009-03-14 Thread macgyver47
One more question if this is not abusing your time Structure of each question: Yes No jQuery('.choix').click(function(e) { $(this).parent().hide(); }); as expected your answer hides the content of the question as expected How can I know if first (yes) or second (no) button was clicked I tried i

[jQuery] Re: jQuery each problem

2009-03-14 Thread macgyver47
Thank you very much for a great answer which nearly solved my question in a very elegant way, I have even discovered in studying selectors a little more thouroughly ( jquery doc) that you can use jQuery('.choix').click(function(e) { $(this).parent().parent().hide(); and it will go 2 levels up in

[jQuery] Re: jQuery each problem

2009-03-14 Thread Josh Powell
Yes, forget about using ID's in this way. That's something you had to do before using jQuery. Think about how your HTML is structured and things are named/classed and the order they are in. Take advantage of how easy it is to traverse the DOM with jQuery. If yo uhave link 1 Description

[jQuery] Re: jQuery each problem

2009-03-13 Thread macgyver47
What it does: jQuery('.choix1').click(function(){ jQuery('#quest1').hide(); When you click on either button related to question 1 it just hides the div id="quest1" What I would like to do is something like: for (i=1; i<=6; i++){ $("choix " + i ).click function(){ $("#quest"+i).hide(); } So e

[jQuery] Re: jQuery each problem

2009-03-13 Thread Josh Powell
What this is doing: jQuery('.choix1').click(function(){ jQuery('#quest1').hide(); }); is looping through every element on the page with a class of 'choix1', so you could either change all of the elements you want to loop though classes to choix and then do jQuery('.choix').click(function(){

[jQuery] jQuery each problem

2009-03-13 Thread macgyver47
Hi I am new to jQuery and learning slowly Here is the problem I have 6 questions each of them has 2 buttons ( yes or no radio buttons) When user clicks on 1 answer I would like to hide the entire question I have achieved to do this for 1 question but no success looping through all 6 questions ! Ye

[jQuery] each on a css class

2009-02-20 Thread Dan B.
so i have a class "positiveMessage" I use throughout the page and i always want to fade them (FAT style). I'm starting to catch, but I can't figure out why this only fades the first one! $('.positiveMessage').each( function(){$(this).vkfade("00dd00")} ); Shouldn't this find every e

[jQuery] each async?

2009-01-20 Thread traunic
Catching up on my Ajaxian RSS feed I came across an article that linked to: http://www.nczonline.net/blog/2009/01/13/speed-up-your-javascript-part-1/ It made me think, could jQuery benefit from a $.eachAsync method? I think there are some cases where this could be beneficial. p.s. The comments

[jQuery] $.each help for radio button validation

2008-10-22 Thread Steve
Hi Everyone, I'm new at this and can't figure out how to use the $.each properly. Let me try to explain more about my Quiz project: 1. I have a dynamic set of Radio Buttons that are grouped. 2. I want to validate that at least 1 is checked per group. 3. If a radio button is not checked in a grou

[jQuery] Re: Poor Performing jQuery .each()

2008-10-08 Thread Coryt
Sorry for the last question, I realize what is happening now. It seems to be a quirk of the .html() which only ouputs the inner html, so it's not a problem with the clone like I originally thought.

[jQuery] Re: Poor Performing jQuery .each()

2008-10-08 Thread Coryt
I noticed something else that is a little weird when cloning. If I execute the following snippet, I see the table tags and all the inner html: var $template = $("#LineItemsTableTemplate").clone() alert($template.html()); Item Code Price Level De

[jQuery] Re: Poor Performing jQuery .each()

2008-10-08 Thread Coryt
Dave, missed your last question, yes, because of the initial performance issue I was having, I was limiting my SQL resultset to be exactly 100 and if there were more rows available, I appended a blank row making 101 rows all the time. Therefore I could always tell that if I had 101 rows, more reco

[jQuery] Re: Poor Performing jQuery .each()

2008-10-08 Thread Coryt
Thanks for all the tips Michael and Dave, very much appreciated. Michael, to answer your questions, there is a way to get the .Net generated prefix, and I did mean to use insertAfter. It rendered correctly in IE but not in FF so I didn't notice it immediately. I have been busy with a few other t

[jQuery] Re: Poor Performing jQuery .each()

2008-10-07 Thread Dave Methvin
I am thinking Mike is right, and you wanted insertAfter rather than appendTo. > I could build a local string, then once the loop finishes, > append the string where I need it. Don't give up on your DOM approach yet,the performance of the [id$=] selector may be the killer and your current approac

[jQuery] Re: Poor Performing jQuery .each()

2008-10-07 Thread Michael Geary
Great, now (I think) I'm understanding better what you're doing. Is there no way to find out what that .NET-assigned prefix is? That would let you do a direct #id lookup. If you can't do that, one thing that will speed up the selectors a lot is to add the tagname. Also, it appears that the pref

[jQuery] Re: Poor Performing jQuery .each()

2008-10-07 Thread Coryt
Ah, yes, sorry, the @ selectors are because I am using .net, which alters rendered control ID values. Therefore I need to search for the end of the ID. >From what i read and as you noted, the selector $( "[EMAIL PROTECTED]" + GPRowID + "]", "[EMAIL PROTECTED]" ), would use "[EMAIL PROTECTED] $=gvB

[jQuery] Re: Poor Performing jQuery .each()

2008-10-07 Thread Michael Geary
Next thing I want to see is the HTML that the code you generate is being inserted into. I'm having trouble following this selector: $( "[EMAIL PROTECTED]" + GPRowID + "]", "[EMAIL PROTECTED]" ) My guess is that the @ characters are left over from some old jQuery syntax? And so it would find an e

[jQuery] Re: Poor Performing jQuery .each()

2008-10-07 Thread Jörn Zaefferer
Try jsbin.com for a testpage: http://jsbin.com/ Jörn On Tue, Oct 7, 2008 at 4:20 PM, Coryt <[EMAIL PROTECTED]> wrote: > > Unfortunately I don't have a place to put up a test page. > Here is the html template: > > > > > > >

[jQuery] Re: Poor Performing jQuery .each()

2008-10-07 Thread Coryt
Unfortunately I don't have a place to put up a test page. Here is the html template:

[jQuery] Re: Poor Performing jQuery .each()

2008-10-07 Thread Michael Geary
Ah, my mistake. I saw all the template.find() calls and didn't pay close enough attention. OK, now it's clear that the problem is all the DOM manipulation inside the loop. (The performance of $.each() itself is the least of your worries.) You can easily speed this up by a factor of 10 or more by

[jQuery] Re: Poor Performing jQuery .each()

2008-10-07 Thread Coryt
Actually the data is being returned as json. sample data: [ { "LineItemType":2, "DocumentNumber":"COM", "Description":"DREG09-rbl2105-1000.com", "SubTotal":7.74000, "TaxTotal":0.39000, "Total":8.13000, "Quantity":1.0 }, {

[jQuery] Re: Poor Performing jQuery .each()

2008-10-06 Thread Michael Geary
Is there any possibility that you can get JSON data instead of XML? It will be *much* faster. If not, then we can talk about how to optimize the XML parsing and jQuery operations - although that is a much tougher question. -Mike > I am having some trouble tracking down why this relativily > si

[jQuery] Poor Performing jQuery .each()

2008-10-06 Thread Coryt
I am having some trouble tracking down why this relativily simple client-side template is performing so poorly. Using js to make an ajax call and retrieve a small amount of data, limited to 100 rows being returned. I've tracked the problem down to the actual jQuery iteration, here is my code: f

[jQuery] $().each() only iterates through first item

2008-10-05 Thread sydneyos
I have the following expression where is_preferred_email is a class assigned to three elements in my page: $j(".is_preferred_email").each( function(i) { this[i].checked = false; } ); if I put "alert(this[i].name);" in the function, I only e

[jQuery] each() odd behavior

2008-09-04 Thread Rodrigo Paiva
Hello. I'm trying to make external links open in a new window but the each() seems a little strange. Am I missing something in the code below? Because "this" gets the "href" attribute of the element, instead of getting the current element itself. The strangest of it all is when I run this snippe

[jQuery] each() how to change the element text ?

2008-06-07 Thread Adwin Wijaya
Hi ... I just want to modify my del.icio.us page so that the font color won't look bad (using jquery and greasemonkey) ... :) I did that .. and now I want to change the text inside like this [code]saved by 651 other people [/code] but I don't know how to modify text "saved by ... other people

[jQuery] $.each() versus for() -- array size inconsistency between IE and FF

2008-04-30 Thread jquertil
I just posted something around problems with IE counting an object variable size differently than FF does. I dont know how to fix it without changing the $.each() statement with a for() loop. for(i=0; i

[jQuery] $.each on HTML string returned from AJAX?

2008-04-08 Thread OhNoMrBill
I am trying to run an .each on form subelements of some html returned in an AJAX request. Like so: var myReturnedText = "some text returned from server that contains one or more forms..."; $("form").each( function() { $(this).removeAttr("onsubmit"); } ); What I am having t

[jQuery] each() without the last element?

2008-02-13 Thread howa
Hello, I want to loop thru each elements with the each() function, except I want to skip the last element, are there simple method? Thanks,

[jQuery] each help

2007-11-15 Thread rayfidelity
Hi, I have this in each row (a couple of rows...) i'd like to calculate the data function test(){ $("[EMAIL PROTECTED]").each(function(i){ var price = $("[EMAIL PROTECTED]'price[]']").val(); var qty = $("[EMAIL PROTECTED]'qty[]']").val(); res = price * qty; $(

[jQuery] "each()" and "this" problems

2007-09-23 Thread Pluthos
Help! I have been into jQuery for about two weeks but I cannot solve this problem. I am trying to lop "bad" branches off the DOM tree. A bad branch is defined as a branch that does not contain any appropriate anchor address located in "keeplist". I have been able to lop off bad leaves (VERSION 1)

[jQuery] Each events and safari

2007-09-17 Thread Daniel Rossi
Hi ive noticed the each event only gets called once per page load in safari. Is there any way around this. Is it a bug ?

[jQuery] .each "this" inside class

2007-08-12 Thread Eridius
now when i use the .each function, inside that function "this" points to the element however i am using .each inside a class and "this" point to the class. Is thier another way to access the element of the /each function without using "this"? -- View this message in context: http://www.nabble.