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
> $('#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
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
Hi!
I have this code:
$("form.uplform").live('submit', function(){
if($(this).attr('validate')=='true'){
$("#testform>input").each(function(){
alert($(this).attr('name'));
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'){
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
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
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
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
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
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
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
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
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.
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:/
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
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"/>
>
>
I have articles in a group of divs
POSTED: 15 MARCH 2008
1400 HOURS
> SNEAK PREVIEW OF
NO CHILD...
Lorem ipsum
dolor sit am
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
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
$(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
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
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
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
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
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(){
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
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
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
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
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.
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
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
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
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
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
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
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
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:
>
>
>
>
>
>
>
Unfortunately I don't have a place to put up a test page.
Here is the html template:
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
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
},
{
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
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
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
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
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
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
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
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,
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;
$(
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)
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 ?
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.
54 matches
Mail list logo