[jQuery] Working with specific elements from the wrapped set

2010-01-14 Thread north
Hi, I wrote a little equal height plugin. Now, say I have two pairs of divs on a page, and I want the divs having the same class to have the same height. My function call would look something like this: $('.classOne, .classTwo').equalHeight(); At them moment the plugin looks like this: (functi

[jQuery] Re: setTimeout with variables (in a jQuery statement)

2009-11-04 Thread north
crossing whatever variables may hold >       the same name in another context thus risking them being > overwritten by some >       other script, but I want them to be part of the anonymous > function's context >       when it is called. > > Hope it helps. > > Michel B

[jQuery] setTimeout with variables (in a jQuery statement)

2009-11-04 Thread north
Hi, I'm trying to use a jQuery statement inside a setTimeout function, but I don't get it to work. I tried a lot of variants, like this one (I'm using 'this' because the setTimeout is inside an each function, and the selector is cached/stored in an object, thus the $selector): setTimeout("" + thi

[jQuery] Re: Issue when caching jquery objects

2009-11-03 Thread north
achedSelector.removeAttr('disabled'); > > work as expected? > > On Nov 1, 11:42 pm, north wrote: > > > Hi, > > > I usually cache jquery objects in variables or a config object. > > > Lately I ran into a strange issue with that when trying to do this: &

[jQuery] Issue when caching jquery objects

2009-11-02 Thread north
Hi, I usually cache jquery objects in variables or a config object. Lately I ran into a strange issue with that when trying to do this: $myCachedSelector.attr('disabled', false); The selected object simply remained to be disabled. When I used the normal syntax $('#mySelector').attr('disabled',

[jQuery] Re: Setting option with a variable as its value to selected

2009-08-19 Thread north
Inside $(document).ready(function(), yes... But the link I posted describes the problem I had, and the workaround seems to do its job. :) On 19 Aug., 09:17, Giovanni Battista Lenoci wrote: > north ha scritto:> I found the issue. It's described here for example

[jQuery] Re: Setting option with a variable as its value to selected

2009-08-18 Thread north
I found the issue. It's described here for example: http://csharperimage.jeremylikness.com/2009/05/jquery-ie6-and-could-not-set-selected.html On 18 Aug., 18:09, north wrote: > Nobody any clue why "$('#mySelect option[value="' + myValue + > '"]&#x

[jQuery] Re: Setting option with a variable as its value to selected

2009-08-18 Thread north
Nobody any clue why "$('#mySelect option[value="' + myValue + '"]').attr('selected', 'selected');" of code is throwing an error? On 18 Aug., 16:32, north wrote: > Hi Giovanni, > > this seems to work as well. But somehow

[jQuery] Re: Setting option with a variable as its value to selected

2009-08-18 Thread north
Hi Giovanni, this seems to work as well. But somehow I'm getting the same error (just connected to another line of code). Mabye I'll have to tear the whole script apart and start over... :) Cheers On 18 Aug., 16:16, Giovanni Battista Lenoci wrote: > north ha scritto:> $(&

[jQuery] Setting option with a variable as its value to selected

2009-08-18 Thread north
Hi, I'm trying set an option with a certain value to selected. I'm using this: $('#mySelect option[value="' + myValue + '"]').attr('selected', 'selected'); This has worked in another piece of code I wrote, but now IE 6 and 8 are throwing an error (in the debug bar). It's something similar to th

[jQuery] Re: Saving the state of an ajax form

2009-08-17 Thread north
ount of all browsers to fill in the hidden inputs when the > user clicks the back button. In your place, I'd seriously consider > switching the form submission to AJAX. If you still want the user to > be able to go back with a back button, you could use deeplinking. > > 2009/8

[jQuery] Re: Saving the state of an ajax form

2009-08-17 Thread north
I have to add that my colleague who coded the old version of this page used Sajax and "vanilla" JS, and his page works in all tested browsers. So I thought doing the same with jQuery should be as easy as it gets... :) On 17 Aug., 19:22, north wrote: > Hi, > > I have a page wi

[jQuery] Saving the state of an ajax form

2009-08-17 Thread north
Hi, I have a page with a simple form: 3 hidden fields and 3 selects. I load the data for the first select via Ajax on domready. I have "change" event handlers for all 3 fields. If I select something in the first select, the corresponding data gets loaded into the second select via Ajax etc. So i

[jQuery] Issue with live events, a form and the back button...

2009-08-13 Thread north
Hi, I have build a quite complex widget which contains "some kind of form". It has a form tag, but I'm loading a lot of stuff in there via Ajax etc. Cannot explain it in detail, and the code is too long to paste in here. Now, in a "live('click', function()" I use for one of the form fields, I'm

[jQuery] Re: Loading jQuery without blocking

2009-08-07 Thread north
is causing an unknown error, which isn't an ideal > thing to debug. :P > > Using jQuery to backload any additional plugins or scripts can be > super useful, but including the jQuery library asynchronously seems > like a poor decision. > > On Aug 6, 4:12 am, north wr

[jQuery] Loading jQuery without blocking

2009-08-06 Thread north
Hi all, I played around with Steve Souders' techniques of loading JS without blocking a bit (I had already been using jQuery's getScript/ajax to load bigger chunks of code for certain parts of the site only if necessary). I tried to use what Nicolas Zakas calls "the best way to load JS" (http://w

[jQuery] Re: Unable to get the latest text/value inside a textarea

2009-07-27 Thread north
Hi, I didn't check your code, but when you write "current value" and "old value" I supposed you change those dynamically. In that you should take a look at this: http://docs.jquery.com/Events/live Cheers On 27 Jul., 05:49, JC wrote: > Now, I was not expecting this. You can get the text inside

[jQuery] Caching jQuery objects

2009-07-21 Thread north
Hi, I just created a little widget using jQuery. The code is kinda ugly, but I'm trying to improve it at least a bit. The first thing I wanted to do was to cache the jQuery objects. In this case I created global variables for this. Besides the global variables, I have a couple of functions using

[jQuery] Using variables or jquery selectors when chaining?

2009-07-10 Thread north
Hi, is it better to do this (regarding performance not readability): $('a.updateCartButton').click(function() { $('form[name=updateCartForm]').attr('action', $(this).attr('href')+'#'+ $('img[id^=iconUpdateArticle]').attr('id')).submit(); return false; }); or this: $('a.updateCartButton').click

[jQuery] Using the object literal notation

2009-07-10 Thread north
Hi, the other day I read this article by Alan Storm called "Using jQuery and the Object Literal Singleton/Module Pattern" (http://alanstorm.com/ jquery_object_literal_oop), as well as the interesting appendix chapter "JavaScript that you need to know but might not!" (you can find a nice article o

[jQuery] Inclusion of external scripts ("best" approach)

2009-07-04 Thread north
Hi, I guess most of you are aware of the peformance tip: put JavaScript at the bottom of the page. Now, what I have seen on quite a few pages is that the jquery.js is placed in the header, and a file with all the code inside $ (document).ready somewhere before the tag. What are the benefits of

[jQuery] jQuery selector performance / jQuery Tester

2009-07-02 Thread north
Hi, I just tested all my jQuery selectors using the jQuery Tester (http:// jquery.nodnod.net), and the results seem to "contradict" one thing I read in a performance article: that you should descend from the closest parent ID when using classes in your selector (the article says "April 09", so th

[jQuery] ul.nav a VS. .nav li > a

2009-06-30 Thread north
Hi, yesterday I read an article about jQuery performance. In one part the author talks about selectors and uses .nav li a as an example. He states that before jQuery 1.3., the selector ul.nav a would have been the best way to get all links in the list. In jQuery 1.3., due to the inclusion of