Re: [jQuery] More DOM Query Speed Tests
Hi, ID should be uniqe over the page, so div#myid is redundant. No, it isn't. It should return an empty jQuery-Object in case the Element with the id myid is not a div. That is usefull when you produce your Content dynamically (e.g. with PHP). The same is true for .myclass#myid, or even div.myclass#myid which should return the element with the id myid only if it is a div and has the class myclass: if( $(div.myclass#myid).length 0 ) alert(YEAH, WE GOT IT); else if( $(#myid).length 0 ) alert(Ha, my ID is misused!!); Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Resetting a form/general floundering
Thanks Blair, this was helpful. My major fault, it seems, was the .val, not .html issue. The elements were inserted correctly. I still cannot get $(#nLinkForm).reset(); to work, but by looping through the form elements and setting their value to an empty string or value to false: for (var i=0;i6;i++){ $(#fback+i).val(''); $(#theans+i).val(''); $(#bCorrect+i).attr({checked:false}); } does clear the form for me. I'm sorry, but my level of understanding is quite low - what is the syntax for using resetInput for, say, a text element (#sQuestion). Cheers, Bruce At 11:23 p.m. 18/12/2006, you wrote: jQ shouldn't have any problems finding the added elements. Some things to look at: * First, use $(#sQuestion).val('abc') to change form input values, not html. * Have you tried looking at the DOM with FireBug to make sure the elements are being inserted correctly? * In terms of what you're actually trying to do, I've used something like this when I want to reset only part of a form: * jQuery.fn.resetInput() { * return this.each(function() { this.value=this.defaultValue; }); * }; Blair On 12/18/06, Bruce MacKay mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: Sorry, a typo on my part - I am using #nLinkForm in the code Bruce At 07:58 p.m. 18/12/2006, you wrote: $(nLinkForm) is looking for nLinkForm tags. You need to use css syntax: $(#nLinkForm) for id, $(.nLinkForm) for class. Blair On 12/18/06, Bruce MacKay mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: Hello folks, Please excuse this longish post but I'm seriously confused. I'm building a quiz editor. I have form (#nLinkForm) which is loaded with the page and a submit function bound to it. Once the user has selected the type of quiz, an appropriate set of input elements (text, textarea, checkbox) is loaded into a div (#aqs) within nLinkForm via an AJAX call. The questions/answers entered into these elements are correctly send to the server when the form is submitted. My problem occurs next - I want to reset the form to clear all the contents of the input elements in readiness for another set of question/answers to be entered. I have an image tag set up with the following code... $(img.togAQs).click(function(){$(nLinkForm).reset();$(#aqs).slideDown(slow);}); which I had hoped would clear the contents of the text/textarea etc elements of the form - it doesn't and hence this call for help. What am I doing wrong? A workaround is to load a blank template via another ajax call, but I was hoping to clear the decks client-side. I know the function as a whole is being fired as evidenced by the contents of the aqs div becoming visible/sliding down. After reading the archives, I also tried $(nLinkForm)[0].reset(); to no benefit. Now, after trying $(#sQuestion).html('abc'); as a check to change the contents of one of the text input elements, I'm now thinking that jquery cannot see the form elements within #aqs. Is this the correct interpretation of what's happening/not happening? If so, how do I ensure that jquery does recognise elements introduced into a page via an AJAX call? Thanks, Bruce ___ jQuery mailing list mailto:discuss@jquery.comdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list mailto:discuss@jquery.comdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list mailto:discuss@jquery.comdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] (no subject)
Ok i'm a newbie in jquery and i'm trying to write function that will replace all span class=y!-- --/span element's content with current year. My function looks like this: $(function(){ $(.y).ready(function() { var today = new Date(); var year = today.getFullYear(); document.write(year); }); }); but when i run it - it replaces all the document with current year. In which place my mistake is ? -- FYFI - for your fucking information ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] (no subject)
Hi $(function(){ $(.y).ready(function() { var today = new Date(); var year = today.getFullYear(); document.write(year); }); }); $(function() { $('.y').html((new Date()).getFullYear()); }); Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] (no subject)
Try this (untested): $(function() { $('.y').html( (new Date).getFullYear() ); }); -Mike p.s. Could we avoid profanity on the mailing list? Thanks. _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kristaps Ancans Sent: Tuesday, December 19, 2006 12:44 AM To: discuss@jquery.com Subject: [jQuery] (no subject) Ok i'm a newbie in jquery and i'm trying to write function that will replace all span class=y!-- --/span element's content with current year. My function looks like this: $(function(){ $(.y).ready(function() { var today = new Date(); var year = today.getFullYear(); document.write(year); }); }); but when i run it - it replaces all the document with current year. In which place my mistake is ? -- FYFI - for your fucking information ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to not select something?
Excellent, Dave. Your explanation is much appreciated. I'd tried something similar in my 'period of frustration', but didn't know about the []'s denoting descendents. dave.methvin wrote: What I'm trying to achieve is the element with id=save-search only gets hidden if it does not contain a div with the class=error-message How about this? $(#save-search:not([div.error-message])).hide(); It actually reads very much like the sentence above, once you know what all the syntax means: #save-search// select an element with id=save-search :not( // as long as the following is not found: [ // descendent elements containing div // a div .error-message// with class error-message ]) Notice that it's _very_ important to put the :not right after the id name. If there was a space after the id it would select _descendants_ of #save-search that do not contain div.error-message. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/How-to-not-select-something--tf2843376.html#a7944073 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Position.clone in jquery
I've recently moved from prototype to jquery, and wonder if there's something simmilar to Position.clone. That is, match an arbitrary elements position exactly, (with all the offsets and parents and so on, it's more to it than just match top and left attributes) I googled a bit and came up with a test case on the jquery side for the prototype code, which I found somewhat interesting. Andreas ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Hide div only if no child checkbox is selected
For anyone searching for similar answers, I've since learnt that this works too: $(#testDiv:not([input:checked])).hide(); The explanation (courtesy of Dave Methvin): #testDiv// select an element with id=testDiv :not( // as long as the following is not found: [ // descendent elements containing input // an input :checked// that is checked ]) Notice that it's _very_ important to put the :not right after the id name. If there was a space after the id it would select _descendants_ of #testDiv that do not contain input:checked. -- View this message in context: http://www.nabble.com/Hide-div-only-if-no-child-checkbox-is-selected-tf2817380.html#a7944493 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Position.clone in jquery
Hi Andreas, yes there is something quite similar, if not even better working thing: It's the additional function offset() in the dimensions.js plugin, which you can get via SVN in the plugins directory. Just pick the element you want and do $(myelement).offset(), and you'll get a nice object that contains left/top. Try it! -Paul 2006/12/19, Andreas Wahlin [EMAIL PROTECTED]: I've recently moved from prototype to jquery, and wonder if there's something simmilar to Position.clone. That is, match an arbitrary elements position exactly, (with all the offsets and parents and so on, it's more to it than just match top and left attributes) I googled a bit and came up with a test case on the jquery side for the prototype code, which I found somewhat interesting. Andreas ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Paul Bakaus Web Developer Hildastr. 35 79102 Freiburg ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Finding child element with no class
Hi folks, I am trying to use the InnerFade plugin on a site I am developing using Drupal. In it, I have a block that lists up to the last 5 stories posted. Due to the way Views work in Drupal, I am not able to add a class to the UL element directly, the code looks like below: div id=block-views-last_5_stories class=block block-views h2Last 5 Stories/h2 div class=content div class=view view-last-5-stories div class=view-content view-content-last-5-stories div class=item-list ul li div class=view-item view-item-last-5-stories div class=view-field view-data-node-title a href=#Story 1/a /div /div /li li a href=#Story 2/a /li /ul /div /div /div /div /div Now, the output is rather messy, but it's what I have to deal with :( What I am trying to do is find the UL as the child of div.item-list using the below code: $(document).ready(function(){ $(div.itemlistul).innerfade({ speed: slow, timeout: 4000, type: sequence, containerheight: 220px }); }); However, it does not seem to be finding the child UL element. Can anyone tell me where I am going wrong on this? Thanks, Tane ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Finding child element with no class
Bahh, ignore this email! It was my own typo, the selector should have been div.item-listul, not div.itemlistul as I had. Now it's working :) Tane On 12/19/06, digital spaghetti [EMAIL PROTECTED] wrote: Hi folks, I am trying to use the InnerFade plugin on a site I am developing using Drupal. In it, I have a block that lists up to the last 5 stories posted. Due to the way Views work in Drupal, I am not able to add a class to the UL element directly, the code looks like below: div id=block-views-last_5_stories class=block block-views h2Last 5 Stories/h2 div class=content div class=view view-last-5-stories div class=view-content view-content-last-5-stories div class=item-list ul li div class=view-item view-item-last-5-stories div class=view-field view-data-node-title a href=#Story 1/a /div /div /li li a href=#Story 2/a /li /ul /div /div /div /div /div Now, the output is rather messy, but it's what I have to deal with :( What I am trying to do is find the UL as the child of div.item-list using the below code: $(document).ready(function(){ $(div.itemlistul).innerfade({ speed: slow, timeout: 4000, type: sequence, containerheight: 220px }); }); However, it does not seem to be finding the child UL element. Can anyone tell me where I am going wrong on this? Thanks, Tane ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] (no subject)
You probably shouldn't use document.write() for anything; Dynamic HTML and the DOM have pretty much made is obsolete. document.write() will replace the whole document if you run it at any time except when the document is being loaded. So you can use it inline: span class=yscript var today=new Date(); document.write(today.getFullYear()); /script/span And it gets executed when the document is loaded. But $(..).ready(...) gets executed only after the document has been loaded and the DOM has been created, so calling document.write() will replace the whole document with a new one. Kristaps Ancāns wrote: Ok i'm a newbie in jquery and i'm trying to write function that will replace all span class=y!-- --/span element's content with current year. My function looks like this: $(function(){ $(.y).ready(function() { var today = new Date(); var year = today.getFullYear(); document.write(year); }); }); but when i run it - it replaces all the document with current year. In which place my mistake is ? -- FYFI - for your fucking information ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] oneclick working in Firefox but not IE
Hi, I'm binding an event with oneclick and it's working just fine in firefox, but the contents of the code actually fires itself in IE like an .each instead of binding it to the click event. Here's the context: I've got a page that will list an address, with a little add/remove button. When the button is on the add state, it will add a marker to a google map and bind the remove marker command to it on a click (then change the state to remove. In IE, when the add button is clicked, it will add the marker to the map and immediately remove it. Here's the code in question: function removeMarkerOnClick(marker, element, map) { // Use the default map if no map is passed map = map || default_map; // make the $(action_map).click() do overlay removal [it's usually passed a marker, but should be able to accomidate other overlay types] $(element).oneclick(function() { alert(I am removing this marker!); map.removeOverlay(marker); }); }; it's called by: var locinfo = new LocationInfo(latitude, longitude, firm_name, $(display).html()); if ($(this).attr(action) == add) { $(this).attr(action, delete); $(this).children(img).src(icons/world_delete.png); // Add this address to the map var marker= add_to_map(locinfo); // Allow this marker to be removed removeMarkerOnClick(marker, map_button); } else { $(this).attr(action, add); $(this).children(img).src(icons/world_add.png); } I didn't see this filed as a bug report in Trac. I'm using the latest official release (1.0.4). Is this a known issue? Do people already have workarounds? Thanks! -- View this message in context: http://www.nabble.com/oneclick-working-in-Firefox-but-not-IE-tf2845547.html#a7946023 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Position.clone in jquery
Sweet! Thank you, works completely as advertised (once I remember to show the element I actually want to look at hehe) Andreas On Dec 19, 2006, at 11:30 , Paul Bakaus wrote: Hi Andreas, yes there is something quite similar, if not even better working thing: It's the additional function offset() in the dimensions.js plugin, which you can get via SVN in the plugins directory. Just pick the element you want and do $(myelement).offset(), and you'll get a nice object that contains left/top. Try it! -Paul 2006/12/19, Andreas Wahlin [EMAIL PROTECTED]: I've recently moved from prototype to jquery, and wonder if there's something simmilar to Position.clone. That is, match an arbitrary elements position exactly, (with all the offsets and parents and so on, it's more to it than just match top and left attributes) I googled a bit and came up with a test case on the jquery side for the prototype code, which I found somewhat interesting. Andreas ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Paul Bakaus Web Developer Hildastr. 35 79102 Freiburg ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] plugin: fieldSelection
Alex Brem wrote: So.. am I moving it into the right direction? :) Certainly! You're laying the framework for a lot of things here -- I can see live spelling checks with suggested words on right click, WYSIWYG|M developer friendly API, pruning/filtering of textarea data so on. Keep it up :) ~ Brice ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to not select something?
#save-search// select an element with id=save-search :not( // as long as the following is not found: [ // descendent elements containing div // a div .error-message// with class error-message ]) Nice! Thanks, Dave. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
looking for an ID (which should be unique) after getting the tags is worthless. Should we re-write the case of tag#id to use elem.getElementBYId(), and then remove the element if it's not the right tag? - Brian ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Trouble Replacing class [Was: Re: (no subject)]
Kristaps, Try something like, $(document).ready(function(){ var year = newDate().getFullYear(); $(.y).empty().append(year); }); Cheers, Chris Kristaps Ancāns wrote: Ok i'm a newbie in jquery and i'm trying to write function that will replace all span class=y!-- --/span element's content with current year. My function looks like this: $(function(){ $(.y).ready(function() { var today = new Date(); var year = today.getFullYear(); document.write(year); }); }); but when i run it - it replaces all the document with current year. In which place my mistake is ? -- FYFI - for your fucking information ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Question about remove();
Dave, I love the analogy! :o) My situation is more like: $(#Oven).find(.ChristmasPies).remove().appendTo(#CoolingRack); :o) Only, I didn't know that I had to use .find(). What I've *really* got is two unorderd lists, and I'm trying to move selected items from one list to the other. So, if I wrote something like: $(#ListA).find(li.Selected).remove().appendTo(#ListB); Given that ListA and ListB are both IDs to a UL tag (ul id=ListA) will the appended items automatically be li tags? I hadn't thought about that. I'll assume I've got this right unless I hear differently. Thanks Dave! :o) Chris Dave Methvin wrote: I have the need of removing list items from List A and then adding them to List B. I'm using the .remove() function to remove the elements from the DOM. The API says very urgently that the remove() method doesn't remove the items from the jQuery object, so that I can use them later. How exactly do I go about using them later? I think something like this: $(#listA).find(.chosen).remove().appendTo(#listB); If you are targeting just one node as the example above, the remove() isn't needed because the standard DOM appendChild behavior will remove the node from its old location before putting it in the new location. However, consider this example: $(#stove).find(.lumpsOfCoal).remove().appendTo(.stockings); If you append to multiple targets (e.g., .stockings selects multiple elements) , the original elements are cloned before being appended to each target so the original elements would stay in their old place unless you remove()d them. If you're _not sure_ whether .stockings is going to select multiple nodes, you should use remove() to make sure the .lumpsOfCoal are removed from the #stove. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
2006/12/19, Christof Donat [EMAIL PROTECTED]: Hi, ID should be uniqe over the page, so div#myid is redundant. No, it isn't. It should return an empty jQuery-Object in case the Element with the id myid is not a div. That is usefull when you produce your Content dynamically (e.g. with PHP). The same is true for .myclass#myid, or even div.myclass#myid which should return the element with the id myid only if it is a div and has the class myclass: I know that. My point is that there should not be two elements with same id on the page. At least, I'm developing like that. if( $(div.myclass#myid).length 0 ) alert(YEAH, WE GOT IT); else if( $(#myid).length 0 ) alert(Ha, my ID is misused!!); Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Dragan Krstić krdr http://krdr.ebloggy.com/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Question about remove();
Dave, That worked brilliantly! Thanks so much! Cheers, Chris Dave Methvin wrote: I have the need of removing list items from List A and then adding them to List B. I'm using the .remove() function to remove the elements from the DOM. The API says very urgently that the remove() method doesn't remove the items from the jQuery object, so that I can use them later. How exactly do I go about using them later? I think something like this: $(#listA).find(.chosen).remove().appendTo(#listB); If you are targeting just one node as the example above, the remove() isn't needed because the standard DOM appendChild behavior will remove the node from its old location before putting it in the new location. However, consider this example: $(#stove).find(.lumpsOfCoal).remove().appendTo(.stockings); If you append to multiple targets (e.g., .stockings selects multiple elements) , the original elements are cloned before being appended to each target so the original elements would stay in their old place unless you remove()d them. If you're _not sure_ whether .stockings is going to select multiple nodes, you should use remove() to make sure the .lumpsOfCoal are removed from the #stove. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
If you want to keep performance, maybe it's better to do: if( $(#myid).is('div.myclass')) alert(YEAH, WE GOT IT); else alert(Ha, my ID is misused!!); Wow. When I started writing this reply, I thought of using tagName and className, but is() is so much more elegant. Christof Donat wrote: Hi, ID should be uniqe over the page, so div#myid is redundant. No, it isn't. It should return an empty jQuery-Object in case the Element with the id myid is not a div. That is usefull when you produce your Content dynamically (e.g. with PHP). The same is true for .myclass#myid, or even div.myclass#myid which should return the element with the id myid only if it is a div and has the class myclass: if( $(div.myclass#myid).length 0 ) alert(YEAH, WE GOT IT); else if( $(#myid).length 0 ) alert(Ha, my ID is misused!!); Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
Hi, ID should be uniqe over the page, so div#myid is redundant. [...] I know that. My point is that there should not be two elements with same id on the page. At least, I'm developing like that. But that doesn't make the expression div#myid redundant. Of course the id should be unique, but div#myid has another meaning than #myid. That's why it isn't worthless as Jake said. It even isn't worthless measuring the difference, because div#myid needs to check if the element returned by getElementById() is a div. As Karls results show, there is a noticable difference here. As far as I can judge it, Karls results suggest, that jQuery uses getElementsByTagName() and then search the result for the id. I guess it would be faster to do it the other way round. Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
On Dec 19, 2006, at 1:09 AM, Aaron Heimlich wrote: If you want some more detail (and have Firefox with Firebug 1.0 Beta installed), you can head on over to http:// aheimlich.freepgs.com/tests/jquery/speed-test-firebug/ where I replicated Karl's tests using Firebug 1.0 Beta's script profiling abilities. The results aren't much different from Karl's, but there's still some interesting stuff there like: $(.dialog) does 815 function calls () $('#speech28') does 6 function calls Wow, Aaron, that is very cool. Thanks! On Dec 19, 2006, at 2:32 AM, Dragan Krstic wrote: 2006/12/19, Christof Donat [EMAIL PROTECTED]: Hi, looking for an ID (which should be unique) after getting the tags is worthless. Well, it shouldn't be. I might whant to hide an Element with the id myid only if it is an image. Then I'd try first $('img#myid').hide() and expect it to work like $('#myid').filter('img').hide(). ID should be uniqe over the page, so div#myid is redundant. Dragan, I think what Christof is getting at is this: on any given page, #myid could be uniquely assigned to a div or a paragraph or a span or an image or any other element. So, page 1 could have div id=myid/ div and page 2 could have p id=myid/p If the same script is being included on multiple pages, it might be necessary to specify that an event take place only if #myid is attached to, for example, the div. In this scenario, div#myid is not redundant. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 19, 2006, at 1:09 AM, Aaron Heimlich wrote: If you want some more detail (and have Firefox with Firebug 1.0 Beta installed), you can head on over to http:// aheimlich.freepgs.com/tests/jquery/speed-test-firebug/ where I replicated Karl's tests using Firebug 1.0 Beta's script profiling abilities. The results aren't much different from Karl's, but there's still some interesting stuff there like: $(.dialog) does 815 function calls () $('#speech28') does 6 function calls On 12/18/06, Karl Swedberg [EMAIL PROTECTED] wrote: Thank you for that summary, Jake! And for the stat lesson. :) On Dec 18, 2006, at 11:19 PM, Ⓙⓐⓚⓔ wrote: Since the 7th click is reproducible, and has little to do with the issue, you can discard the value, with a simple note... years of stat classes! conclusions: running thru the whole dom looking for a class is slow. looking for an ID (which should be unique) after getting the tags is worthless. looking for a class after getting a subset of the dom is faster than searching the whole dom. Safari is almost always faster than ff! Just what was expected! GREAT WORK! On 12/18/06, Karl Swedberg [EMAIL PROTECTED] wrote: Hey everyone, I have results of a few more speed tests that I ran this evening at http://test.learningjquery.com/speed-test.htm Method: I clicked 10 times on each query in Firefox 2.0 and Safari 2.0.4 (See HTML source for all code, markup, etc.) I recorded the mode (most common value) and the range of values for each, all in milliseconds. @ FF2 / Safari2 1. $('#speech28') - mode: 1 / 1 - range: 0-1 / 0-4 2. $('div#speech28') - mode: 43 / 32 - range: 42-59 / 30-35 3. $('#final-speech div.final-dialog ') - mode: 5ms / 5ms - range: 4-6 / 3-6 4. $('#final-speech .final-dialog') - mode: 6 / 5 - range: 5-8 / 3-6 5. $('div.final-dialog') - mode: 55 / 40 - range: 28-253 / 40-45 6. $('.final-dialog') - mode: 101 / 51 - range: 83-306 / 51-68 *** Note that queries 5 and 6 have huge ranges in Firefox because of the mysterious seventh click issue. Looks like these tests confirm what we've all been saying on this list about the relative speed of various selectors. This has been a fascinating exercise. I'd love to hear people's analysis, etc. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
Hi, I think what Christof is getting at is this: [...] Yes, exactly. Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
Hi, If you want to keep performance, maybe it's better to do: if( $(#myid).is('div.myclass')) alert(YEAH, WE GOT IT); else alert(Ha, my ID is misused!!); Yes, of course. If I whant to use jQuery methods I could also use filter(): $('#myid').filter('div.myclass').addClass('hereWeGo'); But I think that it would be good if people didn't have to think about alternative constructs for performance reasons. I know it isn't always possible, but I think, the library should do its best to optimize queries. jQuery is not bad here, but there is still some room for improvements. My original point was to show, that it is not worthless, as Jake wrote, to use queries like 'div#myid'. Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
OK, here is an interesting tidbit. I used the test below and and did the 7 click thing, and out of all my tests except one, the long delay happened in has() and once I got it in find(). has() is pretty simple and I wonder if this has less to do with the number of clicks versus the number of regex's we use and dispose or something like that. I love testing!!! It makes one look at what is happening and sometimes you are surprised! but the questions and introspection are always good on occasion. -Steve Aaron Heimlich wrote: If you want some more detail (and have Firefox with Firebug 1.0 Beta installed), you can head on over to http://aheimlich.freepgs.com/tests/jquery/speed-test-firebug/ http://aheimlich.freepgs.com/tests/jquery/speed-test-firebug/ where I replicated Karl's tests using Firebug 1.0 Beta's script profiling abilities. The results aren't much different from Karl's, but there's still some interesting stuff there like: $(.dialog) does 815 function calls () $('#speech28') does 6 function calls On 12/18/06, *Karl Swedberg* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thank you for that summary, Jake! And for the stat lesson. :) On Dec 18, 2006, at 11:19 PM, Ⓙⓐⓚⓔ wrote: Since the 7th click is reproducible, and has little to do with the issue, you can discard the value, with a simple note... years of stat classes! conclusions: running thru the whole dom looking for a class is slow. looking for an ID (which should be unique) after getting the tags is worthless. looking for a class after getting a subset of the dom is faster than searching the whole dom. Safari is almost always faster than ff! Just what was expected! GREAT WORK! On 12/18/06, *Karl Swedberg* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hey everyone, I have results of a few more speed tests that I ran this evening at http://test.learningjquery.com/speed-test.htm Method: I clicked 10 times on each query in Firefox 2.0 and Safari 2.0.4 (See HTML source for all code, markup, etc.) I recorded the mode (most common value) and the range of values for each, all in milliseconds. @ FF2 / Safari2 *1. $('#speech28') * - mode: 1 / 1 - range: 0-1 / 0-4 *2. $('div#speech28') * - mode: 43 / 32 - range: 42-59 / 30-35 *3. $('#final-speech div.final-dialog ') * - mode: 5ms / 5ms - range: 4-6 / 3-6 *4. $('#final-speech .final-dialog')* - mode: 6 / 5 - range: 5-8 / 3-6 *5. $('div.final-dialog')* - mode: 55 / 40 - range: 28-253 / 40-45 *6. $('.final-dialog')* - mode: 101 / 51 - range: 83-306 / 51-68 *** Note that queries 5 and 6 have huge ranges in Firefox because of the mysterious seventh click issue. Looks like these tests confirm what we've all been saying on this list about the relative speed of various selectors. This has been a fascinating exercise. I'd love to hear people's analysis, etc. --Karl ___ Karl Swedberg www.englishrules.com http://www.englishrules.com www.learningjquery.com http://www.learningjquery.com ___ jQuery mailing list discuss@jquery.com mailto:discuss@jquery.com http://jquery.com/discuss/ http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com mailto:discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com mailto:discuss@jquery.com http://jquery.com/discuss/ -- Aaron Heimlich Web Developer [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://aheimlich.freepgs.com http://aheimlich.freepgs.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
Hi all, With the tests I ran (http://fmarcia.info/jquery/speedtest.html [1]), the quickest way to retrieve one element is $(document.getElementById(id)), even better than $('#id')! Off course, to get even better performance, one should cache queries every time it's possible! My 2 cents, Franck. [1] caution: buttons div div strong and div div strong are very slow ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
Dragan, I think what Christof is getting at is this: on any given page, #myid could be uniquely assigned to a div or a paragraph or a span or an image or any other element. So, page 1 could have div id=myid/div and page 2 could have p id=myid/p If the same script is being included on multiple pages, it might be necessary to specify that an event take place only if #myid is attached to, for example, the div. In this scenario, div#myid is not redundant. But that is bad practice. I'll never use same id for different tag in app. Ah, you never know... -- Dragan Krstić krdr http://krdr.ebloggy.com/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] plugins: writing methods vs. objects
When writing plugin, when is best to write simply methods, as opposed to an object with helper functions? Not sure when to use jQuery.foo versus jQuery.fn.foo Thanks. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] plugins: writing methods vs. objects
I've been curious about this myself for jquery in general... I love OO programming and tend to always try to use it (including sticking with PHP objects, etc) unless terribly unnecessary; is there a compelling reason to NOT use objects whenever possible in jquery, since objects provide such marvelous encapsulation/clean code/etc? thanks, --kim --- Anaurag Gupta [EMAIL PROTECTED] wrote: When writing plugin, when is best to write simply methods, as opposed to an object with helper functions? Not sure when to use jQuery.foo versus jQuery.fn.foo Thanks. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
btw, I just added a text input so you can run whatever query you want on the page. just type in the selector -- without $() -- and press the Test! button. In case anyone wants to try but has lost the thread, here is the URL again: http://test.learningjquery.com/speed-test.htm On Dec 19, 2006, at 11:31 AM, Dragan Krstic wrote: Dragan, I think what Christof is getting at is this: on any given page, #myid could be uniquely assigned to a div or a paragraph or a span or an image or any other element. So, page 1 could have div id=myid/div and page 2 could have p id=myid/p If the same script is being included on multiple pages, it might be necessary to specify that an event take place only if #myid is attached to, for example, the div. In this scenario, div#myid is not redundant. But that is bad practice. I'll never use same id for different tag in app. Ah, you never know... As you say, you never know. ;-) We often don't have total control over markup, and I for one would have a much harder time justifying to bosses/clients time spent making each ID refer to a single tag throughout a site than, say, fixing a page that has the same ID applied to more than one element. On Dec 19, 2006, at 11:13 AM, Stephen Woodbridge wrote: OK, here is an interesting tidbit. I used the test below and and did the 7 click thing, and out of all my tests except one, the long delay happened in has() and once I got it in find(). has() is pretty simple and I wonder if this has less to do with the number of clicks versus the number of regex's we use and dispose or something like that. very interesting, indeed. Might be worth someone looking into? I love testing!!! It makes one look at what is happening and sometimes you are surprised! but the questions and introspection are always good on occasion. Yes, well put! --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Speed Tests
In the vein of the discussion we've been having on this list (and, of course, heavily inspired by the first speed test), I've created a more extensive speed test that tests a bunch of similar cases. A word of warning: your browser will not be available for a good 30 seconds or so while the test is running, but it will not lock up. The first thing my code does is test how long it takes to run a $(.class) query, and bases the number of attempts for each test on the speed of that query (not a perfect system, but it should prevent crazy long loads on slow computers. Check the test out at: http://yehuda.jquery.com/jq_test.html -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] plugins: writing methods vs. objects
Not sure when to use jQuery.foo versus jQuery.fn.foo jQuery.foo just creates a function on the jQuery object (technically, on the constructor function). jQuery.fn.foo creates a function on the prototype object of the jQuery object. If you want your function to be available to all jQuery object instances, and to be chainable, use jQuery.fn.foo notation. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Writing Efficient Plugins
When writing plugins, in general, when should I use jquery functions over standard javascript? (Sorry that question expose my ignorance.) I wondering when I should use a this.each in favor of a standard loop statement, or when to use getElementById instead of the dollar function? My worry is that referencing these functions has some overhead costs, and so wondering best practices. That's a good question, Anaurag. There's nothing wrong with using plain-old-javascript in a plugin. Just remember what jQuery is good at. If you're plugin does a lot of DOM selection for example, that plays right into the strength of jQuery. In general, jQuery is quite fast, but don't be wasteful with the jQuery object. For example, avoid code that repeatedly creates a jQuery object like this: jQuery.fn.myPlugin = function(options) { return this.each(function() { $(this).func1(); ... // some processing $(this).func2(); ... // some more processing $(this).func3(); } } in favor of code that caches and reuses the jQuery object: jQuery.fn.myPlugin = function(options) { return this.each(function() { var $this = $(this); $this.func1(); ... // some processing $this.func2(); ... // some more processing $this.func3(); } } ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] NEWS: jQuery in Ajaxian
I'm happy to announce the jQuery project has received some great press via Ajaxian. http://ajaxian.com/archives/jquery-updates-104-documentation-and-people Its awesome to see jQuery getting some great exposure on this top-notch Ajax news site. Rey ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Speed Tests
The first thing my code does is test how long it takes to run a $(.class) query, and bases the number of attempts for each test on the speed of that query (not a perfect system, but it should prevent crazy long loads on slow computers. Check the test out at: http://yehuda.jquery.com/jq_test.html Nice! Karl and Aaron, too, thanks for starting this test framework. I wonder about how sensitive the timings are to the structure of the document. This one has an id on almost every element, which is not typical. Perhaps that is making ids look slower. Notice that $(something).filter(#id) doesn't use document.getElementById but $(#id) does. In those cases, #id is almost as expensive as .class since it has to go through all the elements in the subtree. I don't think it's worth optimizing cases like div#id to make them faster. If you want fast, say #id instead. I would much rather document how to use selectors efficiently than to make jQuery larger to optimize div#id. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] $.getJSON - global scope
Hi, Just wondering whether it's possible to get the $.getJSON -generated object into local scope? Something along the lines of this: $(document).ready(function(){ createObject(); appendObject(); }); function createObject(){ $.getJSON('animal.js',function(json){ animal = json; }); } function appendObject(){ $(body).append(animal.type); } -8---8--- my json: { type : cat } -8---8--- Thanks! -- Jani ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Speed Tests
My results: $('body') 1.33ms 0.64ms 0.62ms $('body div') 34.38ms 34.38ms 34.06ms $('div', [jQuery('div'), jQuery('a')]) 69.06ms 68.12ms 67.82ms document.body.getElementsByTagName('div') 0ms 0ms 0ms $(jQuery.merge(document.getElementsByTagName('div'), [])) 23.12ms 23.12ms 23.44ms $('div') 32.5ms 33.12ms 32.82ms document.getElementsByTagName('div') 0ms 0ms 0ms $('*') 50.62ms 54.36ms 55.94ms document.getElementsByTagName('*') 0ms 0ms 0ms $('.dialog') 61.86ms 65.62ms 68.44ms $('div.dialog') 43.76ms 43.74ms 44.06ms $('div').filter('.dialog') 47.2ms 45ms 50.94ms $('div#speech5') 40ms 39.68ms 42.82ms $('div #speech5') 34.06ms 32.18ms 34.38ms $('#speech5', document.getElementsByTagName(div)) 0.64ms 0.62ms 0.64ms $('div').filter('#speech5') 44.06ms 40.62ms 43.76ms $('#speech5').filter('div') 0.62ms 0.64ms 0.62ms $('#speech5') 0.32ms 0.32ms 0.62ms $('body div.scene div#speech5') 49.38ms 51.56ms 55.32ms $('div.scene div.dialog') 87.18ms 87.5ms 88.44ms !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Yehuda Katz Sent: Tuesday, December 19, 2006 11:01 AM To: jQuery Discussion. Subject: [jQuery] Speed Tests In the vein of the discussion we've been having on this list (and, of course, heavily inspired by the first speed test), I've created a more extensive speed test that tests a bunch of similar cases. A word of warning: your browser will not be available for a good 30 seconds or so while the test is running, but it will not lock up. The first thing my code does is test how long it takes to run a $(.class) query, and bases the number of attempts for each test on the speed of that query (not a perfect system, but it should prevent crazy long loads on slow computers. Check the test out at: http://yehuda.jquery.com/jq_test.html -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] modalContent plugin is not modal
Tim Saker schrieb: I've actually completed a solution to these problems prior to this post. The solution involves updates to both the modalContent plugin and it's dependency, dimensions.js. I just need to finish polishing the changes to conform to the plugin guidelines. Just release 'em when they are polished enough :-) -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Speed Tests
On Dec 19, 2006, at 12:51 PM, Dave Methvin wrote: The first thing my code does is test how long it takes to run a $(.class) query, and bases the number of attempts for each test on the speed of that query (not a perfect system, but it should prevent crazy long loads on slow computers. Check the test out at: http://yehuda.jquery.com/jq_test.html Nice! I agree. Good work, Yehuda! Karl and Aaron, too, thanks for starting this test framework. I wonder about how sensitive the timings are to the structure of the document. This one has an id on almost every element, which is not typical. Perhaps that is making ids look slower. Very good point. Before I threw the test page up there, I raised the same issue (rather, I recalled that the issue had been raised on the list before) about the times varying depending on page complexity. With that in mind, how about this for a more robust test page: 1. start with a simple 3-column layout, plus header and footer, and dump some lorem ipsum in for content. 2. have a form with a. text field for DOM querying, like I have on my current test page. b. textarea for additional markup, and an appendTo text field next to it. That way, you could drop in as many extra DOM elements as you want, wherever you want, and then test a query's speed. If people think this would work and would be useful, I'd be happy to build it. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] FF class manipulation--possible bug
As I've mentioned here before, I'm working on a drag-and-drop file manager right now. In Firefox, I'm getting a lot of class=undefined (or class=droppable selectable name undefined) nodes in the DOM source after a few drag and drop operations. (They should be droppable selectable name, plus a hoverclass.) My guess is that this is happening on line 152 in idrop.js. Before I file this as a bug report, is anyone else experiencing this? -- View this message in context: http://www.nabble.com/FF-class-manipulation--possible-bug-tf2847436.html#a7951868 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Multiple Interface Slideshows on one page not showing up good in IE6, IE7
snagt schrieb: Hello there! Just getting to know the wonderful world of Jquery and all the things written for it. I'm building my new website with my illustration portfolio and am able to implement and modify all the scripts I need, but now I've stumbled upon a problem I can't solve myself.. I'm trying to implement multiple slideshows (from interface.eyecon.ro) into one page. All works fine in Firefox 2 and Opera 9, but not in IE6 and IE7. I've got an example up here: http://snagt.net/slideshow2.php Only a quick guess, I hope that helps others to investigate further: IE has problems with the load/onload event. I tried to implement a display-another-random-image-all-10-seconds. It works fine in FF etc. but changes the image in IE only once. If you want to take a look at the more concise code then islideshow.js, it's here: http://erdeanthomas.de/ (inline js in html source). -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Cursor position inside of textfield / textarea?
Is it possible to get the current cursor offset in a text field? For example Hello world if the cursor is between the H and e could I somehow get the offset of 1? -js ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] FF class manipulation--possible bug
I've narrowed it down more. Every droppable node has class=droppable selectable name undefined on load. Once it has had the hover class applied, whether or not the draggable is actually dropped, its class switches to either just undefined or empty. -- View this message in context: http://www.nabble.com/FF-class-manipulation--possible-bug-tf2847436.html#a7952210 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Cursor position inside of textfield / textarea?
Hi Jonathan, Is this what you're looking for? Posted a few days ago... http://laboratorium.0xab.cd/jquery/fieldselection/ --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 19, 2006, at 1:28 PM, Jonathan Sharp wrote: Is it possible to get the current cursor offset in a text field? For example Hello world if the cursor is between the H and e could I somehow get the offset of 1? -js ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] JQuery driven site
fellows, Finally my first JQuery driven site has been released - http://www.findfreefonts.net . To start by presenting myself - I try to spread the word about JQuery in the ASP.NET world - through my site http://www.aspcode.net/articles/l_en-US/t_default/ASP.NET/ASP.NET2.0/Ajax/category_61.aspx cause the fact is that JQuery has become my JS toolkit choice - and not MS ASP.NET Ajax (formally Atlas).. Anyway, a little nervous cause I'm pretty new/lame when it comes to client side programming - but http://www.findfreefonts.net is my new the JQuery driven site. You might want to take a look, I thought (maybe you get an dns error today, I registered the domain today but found that it resolved instantly - at least for me...) Am using the cssRadio/cssCheckbox plugin, cookie plugin, hovertip etc. I know it doesn't look all right in Firefox etc, but hey, I need something to do waiting for Santa... Just wanted to thank you - and if you look at the site and find some abvious errors/stupid things - please let me know... /Stefan -- View this message in context: http://www.nabble.com/JQuery-driven-site-tf2847615.html#a7952559 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Cursor position inside of textfield / textarea?
Man, I just can't keep up with this list! Yeah, that's 90% of what I'm looking for, I need the ability for a setSelection which would just focus set the cursor/selection position in the field... I found some examples of this. Would you be interested in adding this to your plugin? Cheers, -Jonathan On 12/19/06, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Jonathan, Is this what you're looking for? Posted a few days ago... http://laboratorium.0xab.cd/jquery/fieldselection/ --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 19, 2006, at 1:28 PM, Jonathan Sharp wrote: Is it possible to get the current cursor offset in a text field? For example Hello world if the cursor is between the H and e could I somehow get the offset of 1? -js ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
Stephen Woodbridge schrieb: OK, here is an interesting tidbit. I used the test below and and did the 7 click thing, and out of all my tests except one, the long delay happened in has() and once I got it in find(). has() is pretty simple and I wonder if this has less to do with the number of clicks versus the number of regex's we use and dispose or something like that. I love testing!!! It makes one look at what is happening and sometimes you are surprised! but the questions and introspection are always good on occasion. That is an interesting point. I wonder if it makes sense to cache regular expressions. Eg: function cache(expression, options) { var key = expression + options || ; var regex = cache[key]; if(!regex) { regex = cache[key] = new RegExp(expression, options); } return regex; } Appending the options to the cache key should prevent any ambiguity. The intersting questions: Is it more efficient to cache regular expressions then to let the garbage collected? -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] JQuery driven site
Looks good. When I click on the tag cloud on the left hand side I get this error: Server Error in '/' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a customErrors tag within a web.config configuration file located in the root directory of the current web application. This customErrors tag should then have its mode attribute set to Off. !-- Web.Config Configuration File -- configuration system.web customErrors mode=Off/ /system.web /configuration Notes: The current error page you are seeing can be replaced by a custom error page by modifying the defaultRedirect attribute of the application's customErrors configuration tag to point to a custom error page URL. !-- Web.Config Configuration File -- configuration system.web customErrors mode=RemoteOnly defaultRedirect=mycustompage.htm/ /system.web /configuration fellows, Finally my first JQuery driven site has been released - http://www.findfreefonts.net . To start by presenting myself - I try to spread the word about JQuery in the ASP.NET world - through my site http://www.aspcode.net/articles/l_en-US/t_default/ASP.NET/ASP.NET2.0/Ajax/category_61.aspx cause the fact is that JQuery has become my JS toolkit choice - and not MS ASP.NET Ajax (formally Atlas).. Anyway, a little nervous cause I'm pretty new/lame when it comes to client side programming - but http://www.findfreefonts.net is my new the JQuery driven site. You might want to take a look, I thought (maybe you get an dns error today, I registered the domain today but found that it resolved instantly - at least for me...) Am using the cssRadio/cssCheckbox plugin, cookie plugin, hovertip etc. I know it doesn't look all right in Firefox etc, but hey, I need something to do waiting for Santa... Just wanted to thank you - and if you look at the site and find some abvious errors/stupid things - please let me know... /Stefan -- View this message in context: http://www.nabble.com/JQuery-driven-site-tf2847615.html#a7952559 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/
Re: [jQuery] $.getJSON - global scope
Jani Tarvainen schrieb: Hi, Just wondering whether it's possible to get the $.getJSON -generated object into local scope? Something along the lines of this: $(document).ready(function(){ createObject(); appendObject(); }); function createObject(){ $.getJSON('animal.js',function(json){ animal = json; }); } function appendObject(){ $(body).append(animal.type); } $.getJSON is asynchronous, there your appendObject() is executed before the JSON is available. The easiest solution would be to call appendObject from within the callback for getJSON. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Cursor position inside of textfield / textarea?
Jonathan Sharp schrieb: Man, I just can't keep up with this list! Yeah, that's 90% of what I'm looking for, I need the ability for a setSelection which would just focus set the cursor/selection position in the field... I found some examples of this. Would you be interested in adding this to your plugin? You should check the plugin: fieldSelection thread. Alex Brem writes the plugin Karl posted. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] plugins: writing methods vs. objects
In general, I'd say go with jQuery.fn.foo, that's when you get the $(element).lots().of().nice().functionality(); jQuery.foo creates global functions, like $.getJSON() and the like, not usually what you want. Andreas On Dec 19, 2006, at 18:11, Mike Alsup wrote: Not sure when to use jQuery.foo versus jQuery.fn.foo jQuery.foo just creates a function on the jQuery object (technically, on the constructor function). jQuery.fn.foo creates a function on the prototype object of the jQuery object. If you want your function to be available to all jQuery object instances, and to be chainable, use jQuery.fn.foo notation. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Writing Efficient Plugins
One thing I've wondered quite a bit about, if one should pass in jquery objects to functions (generally internal ones in plugins) or dom pointers. Is there a standard here, or is it on a per usage basis what seems to be best at the moment? Andreas ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] JQuery driven site
Not bad Stefan... The site works fine, but you have some UI issues that you might want to deal with. For example, the search form takes up fully half of the vertical width of the screen. I have to scroll to see ANY of the fonts that come back in my search. May I suggest putting the search inside a hidden DIV that shows up when you click on a Search button? Then the fonts show up all the way at the top, but people can search whenever they need to. Also, your checkboxes need some help...they're very messy and not disorganized. May I suggest putting them in some sort of table or grid of some sort? They'll be easier to use that way and your form will look tons better. Might I also suggest a Search all fonts checkbox? You could either auto-select all of the checkbxoes for the user, or just toggle it in your code to search all cats if that checkbox is checked. Also, I think your choice of a tooltip over each font image is a bad one. It definitely looks cooler but it takes away functionality. Remember that while YOU want people to stay on your site as long as possible, the user wants to get in, find a font (or more) and get out. So anything you do to make that process longer (forcing them to mouseover an image to see what the font name is) will make them leave the site. You need to think about the user and not yourself. What can you do to make the user's time on your site easy and fun as well as rewarding. Remember that there's a million font sites out there. Why would a user want to come to your site over dafont.com or acidfonts.com? It's a great start and I hope I haven't discouraged you. Font sites are always in demand...just make sure your site has something that the other ones don't and your work will pay off. !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Stefan Holmberg Sent: Tuesday, December 19, 2006 12:55 PM To: discuss@jquery.com Subject: [jQuery] JQuery driven site fellows, Finally my first JQuery driven site has been released - http://www.findfreefonts.net . To start by presenting myself - I try to spread the word about JQuery in the ASP.NET world - through my site http://www.aspcode.net/articles/l_en-US/t_default/ASP.NET/ASP.NET2.0/Ajax/ca tegory_61.aspx cause the fact is that JQuery has become my JS toolkit choice - and not MS ASP.NET Ajax (formally Atlas).. Anyway, a little nervous cause I'm pretty new/lame when it comes to client side programming - but http://www.findfreefonts.net is my new the JQuery driven site. You might want to take a look, I thought (maybe you get an dns error today, I registered the domain today but found that it resolved instantly - at least for me...) Am using the cssRadio/cssCheckbox plugin, cookie plugin, hovertip etc. I know it doesn't look all right in Firefox etc, but hey, I need something to do waiting for Santa... Just wanted to thank you - and if you look at the site and find some abvious errors/stupid things - please let me know... /Stefan -- View this message in context: http://www.nabble.com/JQuery-driven-site-tf2847615.html#a7952559 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/
Re: [jQuery] Cursor position inside of textfield / textarea?
Oh, yeah I've been looking at code too long today. Sorry Alex, didn't mean to imply that Karl wrote it. My ALU was a little lagging... -js On 12/19/06, Karl Swedberg [EMAIL PROTECTED] wrote: On Dec 19, 2006, at 2:06 PM, Jonathan Sharp wrote: Would you be interested in adding this to your plugin? Actually, that question should be directed toward Alex Brem, the plugin's creator. Sorry if I gave the impression that the plugin was mine. Alex, what do you think? --Karl On Dec 19, 2006, at 2:06 PM, Jonathan Sharp wrote: Man, I just can't keep up with this list! Yeah, that's 90% of what I'm looking for, I need the ability for a setSelection which would just focus set the cursor/selection position in the field... I found some examples of this. Would you be interested in adding this to your plugin? Cheers, -Jonathan On 12/19/06, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Jonathan, Is this what you're looking for? Posted a few days ago... http://laboratorium.0xab.cd/jquery/fieldselection/ --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 19, 2006, at 1:28 PM, Jonathan Sharp wrote: Is it possible to get the current cursor offset in a text field? For example Hello world if the cursor is between the H and e could I somehow get the offset of 1? -js ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] JQuery driven site
Oh man, of course it doesn't happen for me, neither with FF or IE. Will look into the log. Thanks for your time! On 12/19/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Looks good. When I click on the tag cloud on the left hand side I get this error: Server Error in '/' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a customErrors tag within a web.config configuration file located in the root directory of the current web application. This customErrors tag should then have its mode attribute set to Off. !-- Web.Config Configuration File -- configuration system.web customErrors mode=Off/ /system.web /configuration Notes: The current error page you are seeing can be replaced by a custom error page by modifying the defaultRedirect attribute of the application's customErrors configuration tag to point to a custom error page URL. !-- Web.Config Configuration File -- configuration system.web customErrors mode=RemoteOnly defaultRedirect=mycustompage.htm / /system.web /configuration fellows, Finally my first JQuery driven site has been released - http://www.findfreefonts.net . To start by presenting myself - I try to spread the word about JQuery in the ASP.NET world - through my site http://www.aspcode.net/articles/l_en-US/t_default/ASP.NET/ASP.NET2.0/Ajax/category_61.aspx cause the fact is that JQuery has become my JS toolkit choice - and not MS ASP.NET Ajax (formally Atlas).. Anyway, a little nervous cause I'm pretty new/lame when it comes to client side programming - but http://www.findfreefonts.net is my new the JQuery driven site. You might want to take a look, I thought (maybe you get an dns error today, I registered the domain today but found that it resolved instantly - at least for me...) Am using the cssRadio/cssCheckbox plugin, cookie plugin, hovertip etc. I know it doesn't look all right in Firefox etc, but hey, I need something to do waiting for Santa... Just wanted to thank you - and if you look at the site and find some abvious errors/stupid things - please let me know... /Stefan -- View this message in context: http://www.nabble.com/JQuery-driven-site-tf2847615.html#a7952559 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/ -- Stefan Holmberg Systementor AB Dvärsätt 1467 835 41 Dvärsätt Sweden Office : +46 640 180 95 Cellphone : +46 709 221 694 Web: http://www.systementor.se ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] JQuery driven site
Stefan Holmberg schrieb: Am using the cssRadio/cssCheckbox plugin, cookie plugin, hovertip etc. I know it doesn't look all right in Firefox etc, but hey, I need something to do waiting for Santa... Just wanted to thank you - and if you look at the site and find some abvious errors/stupid things - please let me know... For a start: Give the page a title tag :-) Some other things I noticed: - Give the tag checkboxes some grid/layout. - Add a white (invisible) border on the font preview images and set the border color to black on hover, that should prevent a bit of flicker - Create a real logo - Minimisze the amount of line scripts in the html source; If you need to read server-side generated data from JS, take a look at the metadata plugin: http://jquery.com/dev/svn/trunk/plugins/metadata/metadata.js?format=txt - Remove all those hr/ elements in favor of a bit more stylesheet stuff (eg. border-bottom combined with a bit padding) - Use the latest and greatest compressed version of jQuery (you have 1.0.2 uncompressed) - In case you'd like a slimmer tooltip solution: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ I like it! Bookmarked :-) -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Fix: ExternalInterface breaks jQuery in firefox 2
As I just said in another post on this thread, since the first beta I have fixed a lot of bugs in Firebug that broke some websites. It would be really helpful if you could test with the latest beta, and if it still breaks your site, send me a URL I can test with. Other beta users have done this and I've been able to fix their problem and get their site working again pretty quickly. - Joe my 2ct contribution to this discussion. FF 2.0 firebug 1.0beta cause a lot of problems - even on sites without jQuery :) -- View this message in context: http://www.nabble.com/Fix%3A-ExternalInterface-breaks-jQuery-in-firefox-2-tf2677747.html#a7886794 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] JQuery driven site
Very nice. I tried (check all) and Sort by Most Downloaded then Search and got Bad Request (Invalid URL) FF2 on WinNT I like the nice style and use of effects. -Steve Stefan Holmberg wrote: fellows, Finally my first JQuery driven site has been released - http://www.findfreefonts.net . To start by presenting myself - I try to spread the word about JQuery in the ASP.NET world - through my site http://www.aspcode.net/articles/l_en-US/t_default/ASP.NET/ASP.NET2.0/Ajax/category_61.aspx cause the fact is that JQuery has become my JS toolkit choice - and not MS ASP.NET Ajax (formally Atlas).. Anyway, a little nervous cause I'm pretty new/lame when it comes to client side programming - but http://www.findfreefonts.net is my new the JQuery driven site. You might want to take a look, I thought (maybe you get an dns error today, I registered the domain today but found that it resolved instantly - at least for me...) Am using the cssRadio/cssCheckbox plugin, cookie plugin, hovertip etc. I know it doesn't look all right in Firefox etc, but hey, I need something to do waiting for Santa... Just wanted to thank you - and if you look at the site and find some abvious errors/stupid things - please let me know... /Stefan ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jquery session handling versus PHP
Currently I use PHP's built in session functions to handle ensuring users are logged in, etc. It doesn't work correctly a small percentage of the time, but is robust as far as being able to use the $_SESSION array and other such things. Now that I'm starting to use a bunch of jquery stuff, I'm interested in knowing if there's anything comparable. I hate troubleshooting why sessions aren't working so I'd like something more reliable. I noticed there's a cookie plugin for jquery but it seems to just do basic things. Is there anything comparable to PHP's system in jquery, or should I just stick with PHP? thanks! -kim __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jquery session handling versus PHP
Kim Johnson wrote: Currently I use PHP's built in session functions to handle ensuring users are logged in, etc. It doesn't work correctly a small percentage of the time, but is robust as far as being able to use the $_SESSION array and other such things. Now that I'm starting to use a bunch of jquery stuff, I'm interested in knowing if there's anything comparable. I hate troubleshooting why sessions aren't working so I'd like something more reliable. I noticed there's a cookie plugin for jquery but it seems to just do basic things. Is there anything comparable to PHP's system in jquery, or should I just stick with PHP? Sessions are in large part because HTTP applications used to be stateless and it was the only way to write an application that had flow. In that world the application lived on the server and the browser was just a presentation window. With Javascript and AJAX the application can move into the browser so all the state information is maintained there and then it can request services via AJAX from the server. Services might be: Authentication Service Information requests Data storage requests etc Your data storage services might store application data, application state data, etc. In many ways this is what might have been stored in a persistent session. You could use php servlets to implement the services. Similar ideas, but different way of decomposing the application into components. Smaller modular components foster reuse. -Steve ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
Oh man, that is totally awesome. Just the kind of thing I was hoping people would do with Firebug. The jQuery community rocks! :) - Joe If you want some more detail (and have Firefox with Firebug 1.0 Beta installed), you can head on over to http://aheimlich.freepgs.com/tests/jquery/speed-test-firebug/ where I replicated Karl's tests using Firebug 1.0 Beta's script profiling abilities. The results aren't much different from Karl's, but there's still some interesting stuff there like: -- View this message in context: http://www.nabble.com/More-DOM-Query-Speed-Tests-tf2843982.html#a7955115 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] JQuery driven site
Great work Stefan. Some feedback: - Add a title to your pages. It currently reads Untitled Page - Add the ability to remove a saved font from within the My Saved Fonts page - Modify the top right nav so that each option is clearly delineated. Also, what did you use to show the popup of each letter that the mouse hovers over? Rey Stefan Holmberg wrote: fellows, Finally my first JQuery driven site has been released - http://www.findfreefonts.net . To start by presenting myself - I try to spread the word about JQuery in the ASP.NET world - through my site http://www.aspcode.net/articles/l_en-US/t_default/ASP.NET/ASP.NET2.0/Ajax/category_61.aspx cause the fact is that JQuery has become my JS toolkit choice - and not MS ASP.NET Ajax (formally Atlas).. Anyway, a little nervous cause I'm pretty new/lame when it comes to client side programming - but http://www.findfreefonts.net is my new the JQuery driven site. You might want to take a look, I thought (maybe you get an dns error today, I registered the domain today but found that it resolved instantly - at least for me...) Am using the cssRadio/cssCheckbox plugin, cookie plugin, hovertip etc. I know it doesn't look all right in Firefox etc, but hey, I need something to do waiting for Santa... Just wanted to thank you - and if you look at the site and find some abvious errors/stupid things - please let me know... /Stefan ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
Thanks for stopping by Joe. Firebug rocks man and we're VERY appreciative of your efforts. Thanks for making this amazing tool for us developers. Rey joehewitt wrote: Oh man, that is totally awesome. Just the kind of thing I was hoping people would do with Firebug. The jQuery community rocks! :) - Joe If you want some more detail (and have Firefox with Firebug 1.0 Beta installed), you can head on over to http://aheimlich.freepgs.com/tests/jquery/speed-test-firebug/ where I replicated Karl's tests using Firebug 1.0 Beta's script profiling abilities. The results aren't much different from Karl's, but there's still some interesting stuff there like: ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] JQuery driven site
Stefan, if you wish to keep the same html for the checkbox area, and give it some layout, just a tiny bit of css, will sort out your checkboxes ..(just one way of doing it) div.action nobr {float:left;width:120px} div.action br {clear:left;} ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] More DOM Query Speed Tests
On 12/19/06, joehewitt [EMAIL PROTECTED] wrote: Oh man, that is totally awesome. Just the kind of thing I was hoping people would do with Firebug. The jQuery community rocks! :) - Joe Thanks Joe! I know you've probably been hearing this alot lately, but Firebug (particulary 1.0 beta) really is indescribably amazing. It is an irreplaceable part of my development process. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jquery session handling versus PHP
I'd vote for letting PHP do the session management. That way all of that load is on the server (which is made for handling it). Then you can, at any time, reference a session with AJAX. It's what I do on my cookbook site. !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Stephen Woodbridge Sent: Tuesday, December 19, 2006 3:16 PM To: jQuery Discussion. Subject: Re: [jQuery] jquery session handling versus PHP Kim Johnson wrote: Currently I use PHP's built in session functions to handle ensuring users are logged in, etc. It doesn't work correctly a small percentage of the time, but is robust as far as being able to use the $_SESSION array and other such things. Now that I'm starting to use a bunch of jquery stuff, I'm interested in knowing if there's anything comparable. I hate troubleshooting why sessions aren't working so I'd like something more reliable. I noticed there's a cookie plugin for jquery but it seems to just do basic things. Is there anything comparable to PHP's system in jquery, or should I just stick with PHP? Sessions are in large part because HTTP applications used to be stateless and it was the only way to write an application that had flow. In that world the application lived on the server and the browser was just a presentation window. With Javascript and AJAX the application can move into the browser so all the state information is maintained there and then it can request services via AJAX from the server. Services might be: Authentication Service Information requests Data storage requests etc Your data storage services might store application data, application state data, etc. In many ways this is what might have been stored in a persistent session. You could use php servlets to implement the services. Similar ideas, but different way of decomposing the application into components. Smaller modular components foster reuse. -Steve ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jquery session handling versus PHP
Kim Johnson schreef: Currently I use PHP's built in session functions to handle ensuring users are logged in, etc. It doesn't work correctly a small percentage of the time, but is robust as far as being able to use the $_SESSION array and other such things. Now that I'm starting to use a bunch of jquery stuff, I'm interested in knowing if there's anything comparable. I hate troubleshooting why sessions aren't working so I'd like something more reliable. I noticed there's a cookie plugin for jquery but it seems to just do basic things. Is there anything comparable to PHP's system in jquery, or should I just stick with PHP? This is a good article about cookies and sessions : http://76.162.50.130/?a=articleid=PHP%20Cookies%20vs%20Sessions%20-%20The%20Breakdown The way i use the two most of the time is to put the variables that are used by php and javascript in a cookie and more sensitive data in a session and sometimes i use a mysql table. cookies are useful to make a bridge between sessions. Sessions are easy to use in php but they also have a limited filesize so you can't put too much data in a session. If you use a database you can store anything you want. So i don't think you should switch. try to find a way that works for you. David ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] FF class manipulation--possible bug
I'm sorry for cluttering up the list with a niche issue but I've found a workaround for both parts of the problem: although the Interface documentation lists the Droppable activeclass attribute as optional, leaving it unset causes class corruption. I figure it's harmless to supply one, even if you don't style it, but if you really don't want to, I'd recommend at least initializing it to '', rather than leaving it out entirely. -- View this message in context: http://www.nabble.com/idrop-class-manipulation--possible-FF-bug-tf2847436.html#a7955604 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] xml response with $.get()
Hello there, This may sound like a dumb question, but somehow I can't figure it out: Let's say we have a basic xml file and a simple piece of code: ?xml version=1.0? foo titleThis was loaded from an external XML file./title /foo $.get(ajax-test.xml,function(xml){ alert( $(title,xml).text() ); }); This only works when put directly in $(document).ready(function() { }. I can't receive any response using events (click etc.) Firebug console notices a GET response as long as alert window (unfortunately empty) is visible. Thanks in advance. -- View this message in context: http://www.nabble.com/xml-response-with-%24.get%28%29-tf2848454.html#a7955113 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] xml response with $.get()
Hi, What is your jquery version and browser (version)? Abdul insq wrote: Hello there, This may sound like a dumb question, but somehow I can't figure it out: Let's say we have a basic xml file and a simple piece of code: ?xml version=1.0? foo titleThis was loaded from an external XML file./title /foo $.get(ajax-test.xml,function(xml){ alert( $(title,xml).text() ); }); This only works when put directly in $(document).ready(function() { }. I can't receive any response using events (click etc.) Firebug console notices a GET response as long as alert window (unfortunately empty) is visible. Thanks in advance. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Question about remove();
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Methvin Subject: Re: [jQuery] Question about remove(); If you append to multiple targets (e.g., .stockings selects multiple elements) , the original elements are cloned before being appended to each target so the original elements would stay in their old place unless you remove()d them. If you're _not sure_ whether .stockings is going to select multiple nodes, you should use remove() to make sure the .lumpsOfCoal are removed from the #stove. - BWHAHAHAHAHAHAHAHAHAHAHAHAHAHA -ALEX ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] xml response with $.get()
Im not sure, but try this: $.get(ajax-test.xml,function(xml){ alert( $(title,xml).html() ); }); Untested, blah blah blah. On 12/19/06, insq [EMAIL PROTECTED] wrote: Hello there, This may sound like a dumb question, but somehow I can't figure it out: Let's say we have a basic xml file and a simple piece of code: ?xml version=1.0? foo titleThis was loaded from an external XML file./title /foo $.get(ajax-test.xml,function(xml){ alert( $(title,xml).text() ); }); This only works when put directly in $(document).ready(function() { }. I can't receive any response using events (click etc.) Firebug console notices a GET response as long as alert window (unfortunately empty) is visible. Thanks in advance. -- View this message in context: http://www.nabble.com/xml-response-with-%24.get%28%29-tf2848454.html#a7955113 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/
[jQuery] New design on jquery.com
Good to see some changes being made to the jquery.com site. Links on the top, oh my! -ALEX ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Resetting a form/general floundering
$(#sQuestion).resetInput(). Most plugins create new methods that you can run on a jQuery selection. I haven't actually had to reset an entire form before, but I would expect that you would have to do $(#nLinkForm)[0].reset(). i.e. $(#nLinkForm) // select the form [0] // access the DOM element itself .reset() // run the reset method on the element Blair On 12/19/06, Bruce MacKay [EMAIL PROTECTED] wrote: Thanks Blair, this was helpful. My major fault, it seems, was the .val, not .html issue. The elements were inserted correctly. I still cannot get $(#nLinkForm).reset(); to work, but by looping through the form elements and setting their value to an empty string or value to false: for (var i=0;i6;i++){ $(#fback+i).val(''); $(#theans+i).val(''); $(#bCorrect+i).attr({checked:false}); } does clear the form for me. I'm sorry, but my level of understanding is quite low - what is the syntax for using resetInput for, say, a text element (#sQuestion). Cheers, Bruce At 11:23 p.m. 18/12/2006, you wrote: jQ shouldn't have any problems finding the added elements. Some things to look at: - First, use $(#sQuestion).val('abc') to change form input values, not html. - Have you tried looking at the DOM with FireBug to make sure the elements are being inserted correctly? - In terms of what you're actually trying to do, I've used something like this when I want to reset only part of a form: - jQuery.fn.resetInput() { - return this.each(function() { this.value=this.defaultValue; }); - }; Blair On 12/18/06, *Bruce MacKay* [EMAIL PROTECTED] wrote: Sorry, a typo on my part - I am using #nLinkForm in the code Bruce At 07:58 p.m. 18/12/2006, you wrote: $(nLinkForm) is looking for nLinkForm tags. You need to use css syntax: $(#nLinkForm) for id, $(.nLinkForm) for class. Blair On 12/18/06, Bruce MacKay [EMAIL PROTECTED] wrote: Hello folks, Please excuse this longish post but I'm seriously confused. I'm building a quiz editor. I have form (#nLinkForm) which is loaded with the page and a submit function bound to it. Once the user has selected the type of quiz, an appropriate set of input elements (text, textarea, checkbox) is loaded into a div (#aqs) within nLinkForm via an AJAX call. The questions/answers entered into these elements are correctly send to the server when the form is submitted. My problem occurs next - I want to reset the form to clear all the contents of the input elements in readiness for another set of question/answers to be entered. I have an image tag set up with the following code... $(img.togAQs).click(function(){$(nLinkForm).reset();$(#aqs).slideDown(slow);}); which I had hoped would clear the contents of the text/textarea etc elements of the form - it doesn't and hence this call for help. What am I doing wrong? A workaround is to load a blank template via another ajax call, but I was hoping to clear the decks client-side. I know the function as a whole is being fired as evidenced by the contents of the aqs div becoming visible/sliding down. After reading the archives, I also tried $(nLinkForm)[0].reset(); to no benefit. Now, after trying $(#sQuestion).html('abc'); as a check to change the contents of one of the text input elements, I'm now thinking that jquery cannot see the form elements within #aqs. Is this the correct interpretation of what's happening/not happening? If so, how do I ensure that jquery does recognise elements introduced into a page via an AJAX call? Thanks, Bruce ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Writing Efficient Plugins
When I pass a dom obj, it shows I want it as a dom obj... when I pass a jq obj it shows I want a jq obj... both are cool, it all depends on what you are going to do with it! On 12/19/06, Andreas Wahlin [EMAIL PROTECTED] wrote: One thing I've wondered quite a bit about, if one should pass in jquery objects to functions (generally internal ones in plugins) or dom pointers. Is there a standard here, or is it on a per usage basis what seems to be best at the moment? Andreas ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Help with arrow key navigation
hello all, definately need to start this post off with the I'm a jquery newbie statement. I'm trying to put together a quick search function that alllows for keyboard navigation. Here is an example: http://brilliantretail.com/cases/filter/qs.php Search Example (Try searching for dexter) Once the result set is displayed I would like to be able to arrow down to the desired row. Any help getting me on the right track with how to do this with jquery would be MUCH appreciated! Thanks, David Dexter -- View this message in context: http://www.nabble.com/Help-with-arrow-key-navigation-tf2849095.html#a7957113 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New design on jquery.com
Thanks to the design/web team, at last...I don't have to scroll down at the bottom just to click the PLUGINS section everytime I visit the site... Cheers, cdelfino Alex Cook wrote: Good to see some changes being made to the jquery.com site. Links on the top, oh my! -ALEX ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Extrange problem with .click()
Two HTML elements cannot share the same ID. If you want to use the same description of two elements, use class, and search with $('.CLASSNAME'). Wonder if we could have a sticky for this forum explaining that. RoadRat wrote: Well I really do not know whats wrong in my code. I have two identical click functions on the same page, here you have the details: Somewhere in the html: div id=Showlinks a class=remolink id='450' href=url?parameters ...later a class=taglink id=450 href=url2?parameters /div -- View this message in context: http://www.nabble.com/Extrange-problem-with-.click%28%29-tf2849034.html#a7959958 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Extrange problem with .click()
Nope, this is a mailing list. Theres no way to sticky something in a mailing list ;) On 12/19/06, bander [EMAIL PROTECTED] wrote: Two HTML elements cannot share the same ID. If you want to use the same description of two elements, use class, and search with $('.CLASSNAME'). Wonder if we could have a sticky for this forum explaining that. RoadRat wrote: Well I really do not know whats wrong in my code. I have two identical click functions on the same page, here you have the details: Somewhere in the html: div id=Showlinks a class=remolink id='450' href=url?parameters ...later a class=taglink id=450 href=url2?parameters /div -- View this message in context: http://www.nabble.com/Extrange-problem-with-.click%28%29-tf2849034.html#a7959958 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/
[jQuery] performance issues in IE
Hello, I'm writing a function in a global script that will apply focus to the first visible enabled form field on a page. I'm using the following jQuery expression to find the control: $('#mainContent :input:visible:not(:checkbox):not(:button):not(:submit):not(:image):not([EMAIL PROTECTED]):first') This works exactly as expected, but unfortunately it's quite slow in IE 7 when there is a fairly large amount of HTML (about 12 seconds on a page that contains 2 select lists with several hundred options each). I had assumed that the :first qualifier would cause the search operation to stop after it finds a match, but that doesn't seem to be the case. And the problem doesn't seem to be with any of the other specific qualifiers I'm using; *:first is equally slow. I think I need to do this the long way, traversing the DOM and checking all the conditions manually, just so I can stop when a match is found. Unless anyone can think of a way I can accomplish this and still take advantage of jQuery's coolness in some way? Thanks in advance, Todd ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New design on jquery.com
Actually, that was just me. I'm made some minor tweaks to the design to help tide us over until the new design is ready-to-go. Are there any other critical aspects that need attention until the new official one is ready? --John On 12/19/06, Clodelio Delfino [EMAIL PROTECTED] wrote: Thanks to the design/web team, at last...I don't have to scroll down at the bottom just to click the PLUGINS section everytime I visit the site... Cheers, cdelfino Alex Cook wrote: Good to see some changes being made to the jquery.com site. Links on the top, oh my! -ALEX ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jquery session handling versus PHP
If you auto-fill form fields using php session and want to convert it to a cookie-based storage then its a good choice because you will offload your server. Kim Johnson wrote: Currently I use PHP's built in session functions to handle ensuring users are logged in, etc. It doesn't work correctly a small percentage of the time, but is robust as far as being able to use the $_SESSION array and other such things. Now that I'm starting to use a bunch of jquery stuff, I'm interested in knowing if there's anything comparable. I hate troubleshooting why sessions aren't working so I'd like something more reliable. I noticed there's a cookie plugin for jquery but it seems to just do basic things. Is there anything comparable to PHP's system in jquery, or should I just stick with PHP? thanks! -kim __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] xmlExec - sanitized output
This is probably a noob question. I am using jquery, with the form plugin to submit information, and the xmlExec plugin to handle responses. As far as I can tell, the form plugin works, and the xmlExec receives and deals with an xml file. It all seems to work, but what gets displayed on my screen has been sanitized - amper-less-than-semicolon and amper-greater-than-semicolon instead of . I see what looks like source html displayed, instead of properly-displayed markup. It's not useful, and I can't track down where it gets converted. It looks like source html in both firefox and ie. jquery commands are displayed properly. Again, as far as I can tell, the xml (example shown below) arrives intact, and is processed by xmlExec. I have tried to pare down a source html file to the minimum. An xml file follows. btw, I am new to these forums. Is it good form to quote huge source files when replying? html head script type=text/javascript src=plugins/system/cork/jquery/jquery.js/script script type=text/javascript src=plugins/system/cork/jquery/form.js/script script type=text/javascript src=plugins/system/cork/jquery/xmlExec-1.0.3.js/script script $(document).ready(function() { var options = { before: showRequest, // pre-submit callback after:function(responseXML, responseText) { $.xmlExec(responseXML); }, // post-submit callback dataType: 'xml' }; // bind form1 using 'ajaxForm' $('#myform').ajaxForm(options); // wire the 'Loading...' ajax indicator $('div id=busyLoading.../div') .ajaxStart(function() {$(this).show();}) .ajaxStop(function() {$(this).hide();}) .prependTo('#oops'); $('#busy').hide(); // pre-submit callback function showRequest(formData, jqForm) { $('#output').html(Preparing to submit...); // formData is an array; use $.param to convert it to a string to display it // (form plugin does this automatically when it submits the data) // alert('About to submit: \n\n' + $.param(formData)); return true; // here we could return false to prevent the form from being submitted } }) /script /head body div id=contenthere is a content div br form id=myform name=myform action=cork1.xml method=post input type=text id=name name=name value=asdf input type=submitbr /form br /div div id=oopswas the oops div/div /body /html - an xml example: root append select=#content![CDATA[ prehere is stuff with carriage returns /pre ]]/append append select=#oops![CDATA[here is stuff with breaksbrkilroy br was br here]]/append evalalert(hi mom);/eval /root -- View this message in context: http://www.nabble.com/xmlExec---sanitized-output-tf2857111.html#a7982214 Sent from the jQuery Plugins mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jquery session handling versus PHP
Thanks to all three of you for the responses :) To explain a bit more about the extent of how I use the sessions, the majority of why I use them is to restrict access to certain areas. I have varying levels of permissions on each user account, and do the usual check if they are logged in on each page scenario. In addition I allow selecting a permanent skin choice, which I put into a session variable that expires a zillion years in the future. There are a few other optional flags that I need to know about on each page, per user/session, for similar skin-type reasons -- things that they have chosen not to see, how to see it, etc. I've also sometimes passed an object as a session variable because I didn't want to have to deal with the $_POST array, but that could very well be a terrible coding choice. Given those exact things, do you three (or anyone else) have an opinion on which would be better in php or jquery? The auth, at least, will need to be almost everywhere. thanks, -kim --- Olivier Percebois-Garve [EMAIL PROTECTED] wrote: If you auto-fill form fields using php session and want to convert it to a cookie-based storage then its a good choice because you will offload your server. Kim Johnson wrote: Currently I use PHP's built in session functions to handle ensuring users are logged in, etc. It doesn't work correctly a small percentage of the time, but is robust as far as being able to use the $_SESSION array and other such things. Now that I'm starting to use a bunch of jquery stuff, I'm interested in knowing if there's anything comparable. I hate troubleshooting why sessions aren't working so I'd like something more reliable. I noticed there's a cookie plugin for jquery but it seems to just do basic things. Is there anything comparable to PHP's system in jquery, or should I just stick with PHP? thanks! -kim __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Insist: Extrange problem with .click()
you are missing a ' after the remlink class name, and I think you want to change your select statements to this format: $(#ShowLinks .taglink).click( function () RoadRat wrote: Ok, lets forget the id question. The problem persist: div id='ShowLinks' -- One row: div id='450' a class='taglink' href=blah.php a class='remlink href=bleh.php /div ... other rows and different id's... ... /div script type=text/javascript $(document).ready(function(){ $(#ShowLinks).find(taglink).click(function(){ This one works return false; }); $(#ShowLinks).find(remlink).click(function(){ This one DOES NOT return false; }); }); /script ??? Thanks in advance, RoadRat -- View this message in context: http://www.nabble.com/Extrange-problem-with-.click%28%29-tf2849034.html#a7982862 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] performance issues in IE
Try this (completely untested): $(#mainContent :input:enabled:visible:first) .filter([textarea,select,[EMAIL PROTECTED]'text']]) .each(function() { this.focus(); }); On 12/19/06, Todd Menier [EMAIL PROTECTED] wrote: Hello, I'm writing a function in a global script that will apply focus to the first visible enabled form field on a page. I'm using the following jQuery expression to find the control: $('#mainContent :input:visible:not(:checkbox):not(:button):not(:submit):not(:image):not([EMAIL PROTECTED]):first') This works exactly as expected, but unfortunately it's quite slow in IE 7 when there is a fairly large amount of HTML (about 12 seconds on a page that contains 2 select lists with several hundred options each). I had assumed that the :first qualifier would cause the search operation to stop after it finds a match, but that doesn't seem to be the case. And the problem doesn't seem to be with any of the other specific qualifiers I'm using; *:first is equally slow. I think I need to do this the long way, traversing the DOM and checking all the conditions manually, just so I can stop when a match is found. Unless anyone can think of a way I can accomplish this and still take advantage of jQuery's coolness in some way? Thanks in advance, Todd ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New design on jquery.com
On 12/19/06, John Resig [EMAIL PROTECTED] wrote: Are there any other critical aspects that need attention until the new official one is ready? The header looks really screwed up in IE. Everything seems to have been pushed down real far and the top is cut of a bit. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] xmlExec - sanitized output
It's supposed to be that way! if you slip that lt; stuff into your page it should appear as ! Since the xml is correct xml and you are concerned about things like the carriage returns, you have properly encoded them. Since there is no DTD or schema for the xml you can also write it all without CDATA , and get the xml as it is parsed. (with the returns in it, but under a pre node. On 12/19/06, youngwax [EMAIL PROTECTED] wrote: This is probably a noob question. I am using jquery, with the form plugin to submit information, and the xmlExec plugin to handle responses. As far as I can tell, the form plugin works, and the xmlExec receives and deals with an xml file. It all seems to work, but what gets displayed on my screen has been sanitized - amper-less-than-semicolon and amper-greater-than-semicolon instead of . I see what looks like source html displayed, instead of properly-displayed markup. It's not useful, and I can't track down where it gets converted. It looks like source html in both firefox and ie. jquery commands are displayed properly. Again, as far as I can tell, the xml (example shown below) arrives intact, and is processed by xmlExec. I have tried to pare down a source html file to the minimum. An xml file follows. btw, I am new to these forums. Is it good form to quote huge source files when replying? html head script type=text/javascript src=plugins/system/cork/jquery/jquery.js/script script type=text/javascript src=plugins/system/cork/jquery/form.js/script script type=text/javascript src=plugins/system/cork/jquery/xmlExec-1.0.3.js/script script $(document).ready(function() { var options = { before: showRequest, // pre-submit callback after:function(responseXML, responseText) { $.xmlExec(responseXML); }, // post-submit callback dataType: 'xml' }; // bind form1 using 'ajaxForm' $('#myform').ajaxForm(options); // wire the 'Loading...' ajax indicator $('div id=busyLoading.../div') .ajaxStart(function() {$(this).show();}) .ajaxStop(function() {$(this).hide();}) .prependTo('#oops'); $('#busy').hide(); // pre-submit callback function showRequest(formData, jqForm) { $('#output').html(Preparing to submit...); // formData is an array; use $.param to convert it to a string to display it // (form plugin does this automatically when it submits the data) // alert('About to submit: \n\n' + $.param(formData)); return true; // here we could return false to prevent the form from being submitted } }) /script /head body div id=contenthere is a content div br form id=myform name=myform action=cork1.xml method=post input type=text id=name name=name value=asdf input type=submitbr /form br /div div id=oopswas the oops div/div /body /html - an xml example: root append select=#content![CDATA[ prehere is stuff with carriage returns /pre ]]/append append select=#oops![CDATA[here is stuff with breaksbrkilroy br was br here]]/append evalalert(hi mom);/eval /root -- View this message in context: http://www.nabble.com/xmlExec---sanitized-output-tf2857111.html#a7982214 Sent from the jQuery Plugins 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/
Re: [jQuery] xmlExec - sanitized output
Hi youngwax, Like Blair said, you don't need the CDATA if you're sending back valid XHTML. That said, br is not valid XHTML. Switch that to br / and try it w/o the CDATA. Also, it's great form to post a link to a sample page if at all possible! Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jquery session handling versus PHP
Kim Johnson wrote: Given those exact things, do you three (or anyone else) have an opinion on which would be better in php or jquery? The auth, at least, will need to be almost everywhere. thanks, -kim Kim, Keep your authentication state server side (via PHP's session). If you do it client side (via Javascript cookies) -- it will be (much more) trivial to fake an authenticated state bypass your security check. ~ Brice ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Methods, a new plugin?
That was my gut reaction, but, I think that it's an example of explicit use of a new Iterator interface, a way to make any object work with for in . But, I didn't read it that closely. It took 6-8 years to get to get JavaScript and DOM stable enough for our current applications. I'm not holding my breath on JavaScript 1.7. * [EMAIL PROTECTED] [EMAIL PROTECTED] [2006-12-18 14:31]: That Mozilla design is terrible: people should *NOT* use exceptions for flow control! Exceptions are designed to be exceptional and expensive.. --Jacob This is pretty cool stuff. Not widely available yet, but it's in FF2.0. http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7#Iterators On 12/17/06, John Beppu [EMAIL PROTECTED] wrote: I hope future versions of Javascript give us better ways to iterate. for-in is what's really broken. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Alan Gutierrez - 504 717 1428 - [EMAIL PROTECTED] - http://blogometer.com/ Think New Orleans - http://thinknola.com/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New design on jquery.com
That's an awesome quote on the main page. I expect a jQuery IDE soon that actually WILL read my mind. I start typing: $('span').filter('.links').cli And a little red devo hat pops up with a little speech bubble and taps on my screen: Excuse me, it looks like you're trying to add a click handler. Would you live for me to create it for you, and optimize your selector while I'm at it? Also, I'll add the necessary css to make these span tags have the pointer cursor if you'd like. And by the way, I've placed your lunch order for a roast beef sandwich like you wanted. ETA on that feature? --Erik On 12/19/06, John Resig [EMAIL PROTECTED] wrote: Actually, that was just me. I'm made some minor tweaks to the design to help tide us over until the new design is ready-to-go. Are there any other critical aspects that need attention until the new official one is ready? --John On 12/19/06, Clodelio Delfino [EMAIL PROTECTED] wrote: Thanks to the design/web team, at last...I don't have to scroll down at the bottom just to click the PLUGINS section everytime I visit the site... Cheers, cdelfino Alex Cook wrote: Good to see some changes being made to the jquery.com site. Links on the top, oh my! -ALEX ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] performance issues in IE
Thanks Aaron. That unfortunately didn't make it any faster. Plus I don't think you'd want to apply that filter expression after you've applied the :first qualifier in the initial expression - that could leave you with nothing even when there's a match somewhere on the page. Anyway, I had the initial expression reduced all the way down to: $(#mainContent *:first) and it wasn't any better, which is why I think I'm stuck having to traverse the DOM, as much as I'd like to use a jQuery expression. And as I mentioned, only IE seems to have a problem with it. It works plenty fast in FF. If anyone else has any suggestions, I'd love to hear them. On 12/19/06, Aaron Heimlich [EMAIL PROTECTED] wrote: Try this (completely untested): $(#mainContent :input:enabled:visible:first) .filter([textarea,select,[EMAIL PROTECTED]'text']]) .each(function() { this.focus(); }); On 12/19/06, Todd Menier [EMAIL PROTECTED] wrote: Hello, I'm writing a function in a global script that will apply focus to the first visible enabled form field on a page. I'm using the following jQuery expression to find the control: $('#mainContent :input:visible:not(:checkbox):not(:button):not(:submit):not(:image):not([EMAIL PROTECTED]):first') This works exactly as expected, but unfortunately it's quite slow in IE 7 when there is a fairly large amount of HTML (about 12 seconds on a page that contains 2 select lists with several hundred options each). I had assumed that the :first qualifier would cause the search operation to stop after it finds a match, but that doesn't seem to be the case. And the problem doesn't seem to be with any of the other specific qualifiers I'm using; *:first is equally slow. I think I need to do this the long way, traversing the DOM and checking all the conditions manually, just so I can stop when a match is found. Unless anyone can think of a way I can accomplish this and still take advantage of jQuery's coolness in some way? Thanks in advance, Todd ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQ spotted in some HAWT Mailing List Software
jQuerians, This past month I have focused on rewriting the entirety of poMMo (GPL PHP Mailing List Software). jQuery has become the base library for template files, and a unique interface has been born. This would never have been possible without jQuery, the great minds of this forum (err mailing list!), and all you jQ plugin authors -- my deepest regards to all of you. While I don't consider this yet finished (when is something ever finished?), it is certainly preview-able if not damn near usable ;) The subscriber management page sees the most jQuery love, and thus I'll link there; http://try.pommo.org/admin/subscribers/admin_subscribers.php Please note that this is a software demonstration, and resets twice a day. It is also not officially announced -- I thought you guys/gals deserve a first look ;) Regular old page is; http://www.pommo.org/ Anyway, I'd love to hear what you think. Also, if you have any free time (yeah right !? :) ), I could sure use some help fixing bugs making things better. Thanks again, ~ Brice ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] xmlExec - sanitized output
hey, I am thrilled to get several replies so quickly. The xml file contains greater-signs and less-signs. I had hoped to add markup to my page. It works if I add markup and content with jquery, but with xmlExec, it gets sanitized - I can only add plain content. It seems fairly limiting, like something is not right. I will try correcting the CDATA and br. I put in CDATA to prevent firefox errors when I was looking at the raw xml file to see if it still had less-signs. Thanks for the input. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/xmlExec---sanitized-output-tf2857111.html#a7984343 Sent from the jQuery Plugins mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] xmlExec - sanitized output
I seem to get the same appearance with all combinations of br, br /, [CDATA], or not [CDATA]. I still don't get functional markup. Thanks -- View this message in context: http://www.nabble.com/xmlExec---sanitized-output-tf2857111.html#a7984379 Sent from the jQuery Plugins mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Cursor position inside of textfield / textarea?
Hello Jonathan, as Karl and Jörn already pointed out, at the time I'm coding a plugin which handles all the selection stuff inside an input field / a textarea. The latest Version also includes setSelection. More information can be found in this thread: http://www.nabble.com/plugin%3A-fieldSelection-tf2833491.html Please note: The plugin is relatively new and I have the feeling that some of the API may change in the near future as I already got some suggestions on how to improve the plugin. :) Also I have to write some documentation... Alex Jonathan Sharp wrote: Is it possible to get the current cursor offset in a text field? For example Hello world if the cursor is between the H and e could I somehow get the offset of 1? -js ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] xmlExec - sanitized output
I seem to get the same appearance with all combinations of br, br /, [CDATA], or not [CDATA]. I still don't get functional markup. Can you post a sample page somewhere? That would help us track it down. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/