Re: [jQuery] Non-Destructive jQuery
i am grateful that you have been able to contain the destructive power of jquery with such little code John Resig wrote: > > Hi Everyone - > > There's been some rabble-rousing concerning the destructive nature of > jQuery (it's ok, rousing is a good thing ;-)). I claimed that it'd be > easy to have it exist as a plugin. Well, it took me all of 10 minutes, > but here it is: > > jQuery.fn._pushStack = jQuery.fn.pushStack; > > jQuery.fn.pushStack = function(){ > var ret = jQuery.fn._pushStack.apply( jQuery(this), arguments ); > ret.prevObject = this; > return ret; > }; > > jQuery.fn.end = function(){ > return this.prevObject || jQuery([]); > }; > > You can see a demo (requires Firebug) here: > http://john.jquery.com/jquery/test/destruct.html > > So, if the destructive nature of jQuery bothers you - and you can't > wait for jQuery 2.0, then just stick the above code in the header of > your site (after jQuery) and you'll be good to go. Enjoy! > > --John > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Non-Destructive-jQuery-tf2482924.html#a6926106 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Ajax call
ahhh.. you are right... thanks Brandon Aaron wrote: > > This is due to security limitations of firefox and requesting data > outside the scripts domain. There are workarounds ... mainly using > iframes to retrieve the data. > > -- > Brandon Aaron > > On 10/19/06, Tombo <[EMAIL PROTECTED]> wrote: >> >> $.get("http://www.yahoo.com",function(txt){ >> alert(txt); >> }); >> >> This code works in IE but does not work in firefox. anyone know why? >> Thanks >> >> Tom >> -- >> View this message in context: >> http://www.nabble.com/Ajax-call-tf2476168.html#a6905447 >> Sent from the JQuery mailing list archive at Nabble.com. >> >> >> ___ >> jQuery mailing list >> discuss@jquery.com >> http://jquery.com/discuss/ >> > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Ajax-call-tf2476168.html#a6905987 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Ajax call
$.get("http://www.yahoo.com",function(txt){ alert(txt); }); This code works in IE but does not work in firefox. anyone know why? Thanks Tom -- View this message in context: http://www.nabble.com/Ajax-call-tf2476168.html#a6905447 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] String concatenation optimization
i like to mess around with javascript optimization lately. i wrote this little page to show the different speeds of string concatenation code. i tested in firefox and IE7. just looking for any feedback or suggestions. thx http://www21.brinkster.com/tomhere/test/test36.htm -- View this message in context: http://www.nabble.com/String-concatenation-optimization-tf2411788.html#a6722790 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] SlideDown Height Problem
the third link doesn't expand big enough for me to read all the content. i'm using IE7 Glen Lipka wrote: > > I am working on a redesign of payroll.com which leverages jQuery a bunch. > I am having one bug that I can't seem to fix. > > Sample: > http://glenlipka.kokopop.com/jQuery/payroll/PayrollIntroduction.htm > > In Firefox, Click on the last link and then scroll down. > > When I use show(0), the height works fine. When I use slideDown("slow") > the > text goes over the footer.. > > What am I doing wrong? :( > > Thanks for the help, > > Glen > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/SlideDown-Height-Problem-tf2396908.html#a6683621 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] String Parsing
nice. i like that regular expression example. but i agree that the split method is probably quicker. thanks Christof Donat wrote: > > Hi, > >> i want to grab just the filename and extension from the following string: >> >> str1="F:\\Test1\\Test2\\Test3\\test.txt"; >> >> i want to grab "test.txt" >> >> i use this code: >> >> file1=(str1.split("\\"))[(str1.split("\\")).length-1]; >> >> i was wondering if there is a better way to grab that part of the string > > Yes, of course: > > var tmp = str1.split("\\"); > file1 = tmp[tmp.length-1]; > > That way the JS-interpreter doesn't need to split the string twice. I > think > that this is the fastest aproach. > > Another aproach could be: > > file1 = str1; > var tmp; > while( (tmp = file1.indexOf("\\")) >= 0 ) file1 = file1.substr(tmp+1); > > But I think, that is slower. The advantage is that it is easy to > understand > that you ar working on the string. > > Yet another aproach: > > file1 = str1.match(/[^\\]*$/); > > I guess this can compete in performance with the split()-method - shold be > just a bit slower since the evaluation of a regular expression is more > complex than a simple split. > It is the shortest variant, but not the most readable. > > If you ask me I would either recomend the split()-method or the > regular-expression-method. > > Christof > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/String-Parsing-tf2376878.html#a6623119 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] String Parsing
yes. this was the elegance i was looking for. thx Blair Mitchelmore-2 wrote: > > To avoid running split twice, you could do it this way (removes IE5 from > compatibility however): > > var file1 = str1.split("\\").pop(); > > -blair > > Tombo wrote: >> this might not be jquery related, but i noticed there are a lot of savvy >> javascript programmers in this mailing list. >> >> i want to grab just the filename and extension from the following string: >> >> str1="F:\\Test1\\Test2\\Test3\\test.txt"; >> >> i want to grab "test.txt" >> >> i use this code: >> >> file1=(str1.split("\\"))[(str1.split("\\")).length-1]; >> >> >> i was wondering if there is a better way to grab that part of the string >> >> Thx for any help > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/String-Parsing-tf2376878.html#a6622882 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] String Parsing
ahhh that works nicely although i just had to add one file1=str1.substring(str1.lastIndexOf("\\")+1); J?rn Zaefferer wrote: > > Tombo schrieb: >> i want to grab just the filename and extension from the following string: >> >> str1="F:\\Test1\\Test2\\Test3\\test.txt"; >> >> i want to grab "test.txt" >> >> i use this code: >> >> file1=(str1.split("\\"))[(str1.split("\\")).length-1]; >> >> >> i was wondering if there is a better way to grab that part of the string >> > How about this: > file1 = str1.substring( str1.lastIndexOf("\\") ); > > -- J?rn > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/String-Parsing-tf2376878.html#a6622835 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] String Parsing
this might not be jquery related, but i noticed there are a lot of savvy javascript programmers in this mailing list. i want to grab just the filename and extension from the following string: str1="F:\\Test1\\Test2\\Test3\\test.txt"; i want to grab "test.txt" i use this code: file1=(str1.split("\\"))[(str1.split("\\")).length-1]; i was wondering if there is a better way to grab that part of the string Thx for any help -- View this message in context: http://www.nabble.com/String-Parsing-tf2376878.html#a6622443 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Using hide method
$("table tr").eq(0).hide("slow"); this works fine for me with IE7 Nando Vieira wrote: > > Hello there! > > I'm trying to hide the first row with > > > $('tbody tr').eq(0).hide('slow') > > But this code throws an error (eq function doesn't exist). > > > $('tbody tr').get(0).hide('slow') > > Does not work either. > > How do I use "eq" with "hide" method? > > -- > Nando Vieira > bloggin' @ http://simplesideias.com.br > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Using-hide-method-tf2241712.html#a6217908 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why I love jQuery...
ahhh.. very good question: i am very curious how you would: 1) append a paragraph 2) pause 3 seconds 3) and then remove the paragraph from the DOM without any effect. all in one line of code? Klaus Hartl wrote: > > > > Tombo schrieb: >> could you give a live example for us to ponder >> i want to feel the love first hand :-) >> >> >> Klaus Hartl wrote: >>> >>> $('No images >>> found.').appendTo('#msg').pause(3000, >>> 'fx').fadeOut('normal', function() { $(this).remove() } ); > > This is taken from production... not yet live. The snippet itself is no > rocket science, but what I meant: I create a paragraph with a message on > the fly, put it somewhere into the DOM tree, wait 3 seconds, fade that > paragraph out smoothly and then remove it from the DOM again - all in > one line of code. With traditional javascript that would have taken 100 > lines probably... And besides, the code is readable like nothing else... > > > -- Klaus > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Why-I-love-jQuery...-tf2239042.html#a6214227 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why I love jQuery...
could you give an example for us to ponder i want to feel the love first hand :-) Klaus Hartl wrote: > > > $('No images > found.').appendTo('#msg').pause(3000, > 'fx').fadeOut('normal', function() { $(this).remove() } ); > > Do I need to say more? > > > PS: Ah yes, thanks for the pause plugin, Jonathan! > > > -- Klaus > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Why-I-love-jQuery...-tf2239042.html#a6211840 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Checking checkboxes
Uncheck all checked boxes: $("[EMAIL PROTECTED]").each(function(){this.checked=false;}); Check all checked boxes: $("[EMAIL PROTECTED]").each(function(){this.checked=true;}); Grant Bristow wrote: > > I'm BRAND new to jQuery. I've successfully (and easily) selected all of > the checked checkboxes, but now, I would like to check (or uncheck) > them. Could someone show me how this is done? Thanks in advance. > > > Grant > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/Checking-checkboxes-tf2199700.html#a6090626 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/