Re: [jQuery] Replying to threads
Ⓙⓐⓚⓔ schrieb: I use gmail, it threads like a champ macintosh mail.app is also good, What other threaded mail readers do you guys use that we can recommend for the aol crowd? Thunderbird of course. I found that Mac's Mail.app is not capable of showing threads in a reaonable way (there's only one level of indentation)... -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Please help (again, sorry)..NextUntil not working
Hi John, thanks again for your help, unfortunately I have deployed your suggestions and am still unable to get it to work. You can view my testpage at: http://members.optusnet.com.au/greg.bird/mm/collapse.html My .js now reads: $(document).ready(function(){ BuildNav(); }); //DEFINE NextUntil FUNCTION $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } console.log(this,cur,match); }); return this.pushStack( match, arguments ); }; /*BUILD SIDE NAVIGATION*/ function BuildNav() { $(#content h2).each(function(){ $(this).nextUntil(h2).wrap(div class='note'/div); }); } I have logged the script and it appears that the match array is not being populated. I suspect that the Jquery.merge function is not triggering properly Does this function work with JQUERY 1.0.2? In note in the JQUERY doco that the function call is now $.merge. Trialled this without success. My aim here is to put a unique div around each section of the page and then dynamically create an expand/collapse navigation system. Have already achieved a similar result with a sliding navigation system. You can see this at: http://members.optusnet.com.au/greg.bird/mm/index.html This was easier as I didn't need to wrap div's around anything, but simply anchor to the existing H2's Have you got any suggestions? Do you have any test pages so that I can view your implementation? Thanks in advance, Greg John Resig wrote: Hi Greg - I created a plugin a while back that can help with this, called nextUntil: $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } }); return this.pushStack( match, arguments ); }; Just include that after you include jquery.js then do the following: $(#content h2).each(function(){ $(this).nextUntil(h2).wrap(div class='note'/div); }); Just 3 lines! Not too shabby :) --John On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Hi everyone. I am attempting to develop some dynamic in page navigation. I am a big fan of structural markup. Each H2 represents a new section of the current document. I wish to: 1. Find each H2 2. Wrap this in a unique div, up to (but not including) the next H2. This will then be used to further manipulate the page div id=content h2First section/h2 ...[arbitary HTML] h2second section/h2 ...[arbitary HTML] h2third section/h2 . /div Becomes: div id=content div id=1 h2First section/h2 ...[arbitary HTML] /div div id=2 h2second section/h2 ...[arbitary HTML] /div h2third section/h2 . /div Here is the JQuery that I have developed to date: $(document).ready(function(){ BuildNav(); }); /*BUILD SIDE NAVIGATION*/ function BuildNav() { //add back to top links before each H2 $('#content h2').each(function(i){ if(i==0){//FIRST H2 $(this).before('div id='+ i +' class=note')//START A NEW DIV WITH UNIQUE ID } else { $(this).before('/divdiv id='+ i +' class=note');//TERMINATE PREVIOUS DIV, BEGIN NEW ONE } }) $('#content').append('/div');//TERMINATE FINAL DIV } This looks sensible to me but fails. It appears you cannot inject unterminated tags and that JQUERY automatically closes tags on insertion, resulting in: div id=content div id=1/div h2First section/h2 ...[arbitary HTML] div id=2/div h2second section/h2 ...[arbitary HTML] div id=3/div h2third section/h2 . /div Can anyone give me any clues? Thanks in advance, Greg Bird ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ Quoted from: http://www.nabble.com/Please-help%21-Dynamically-Wrapping-DIV%27s-around-structural-markup.-tf2464168.html#a6869443 -- View this message in context: http://www.nabble.com/Please-help%21-Dynamically-Wrapping-DIV%27s-around-structural-markup.-tf2464168.html#a6870422 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Please help (again, sorry)..NextUntil not working
This is just a guess:function BuildNav() { $(#content h2).each(function(){ $(this).before(div class='note newdivmarker'/div).nextUntil(h2).appendTo(.newdivmarker); $(div.newdivmarker).removeClass(newdivmarker); });}It relies on the assumption that appendTo moves the origonal element list, rather than clones them. Basically: It adds your div before the heading, with a temporary marker so we can find it againSelects all elements until the next headingMoves them to the divRemoves the marker from the div BlairOn 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Hi John,thanks again for your help, unfortunately I have deployed your suggestionsand am still unable to get it to work.You can view my testpage at: http://members.optusnet.com.au/greg.bird/mm/collapse.htmlMy .js now reads:$(document).ready(function(){BuildNav();});//DEFINE NextUntil FUNCTION$.fn.nextUntil = function(expr) { var match = [];this.each(function(){var cur = this.nextSibling;while ( cur jQuery.filter( expr, [cur] ).r.length ) {match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling;}console.log(this,cur,match);});return this.pushStack( match, arguments );};/*BUILD SIDE NAVIGATION*/function BuildNav() { $(#content h2).each(function(){$(this).nextUntil(h2).wrap(div class='note'/div);});}I have logged the script and it appears that the match array is not being populated.I suspect that the Jquery.merge function is not triggeringproperlyDoes this function work with JQUERY 1.0.2?In note in the JQUERY doco thatthe function call is now $.merge.Trialled this without success. My aim here is to put a unique div around each section of the page and thendynamically create an expand/collapse navigation system.Have alreadyachieved a similar result with a sliding navigation system.You can see this at:http://members.optusnet.com.au/greg.bird/mm/index.htmlThis was easier as I didn't need to wrap div's around anything, but simply anchor to the existing H2'sHave you got any suggestions?Do you have any test pages so that I can viewyour implementation?Thanks in advance, GregJohn Resig wrote: Hi Greg - I created a plugin a while back that can help with this, called nextUntil: $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } }); return this.pushStack( match, arguments ); }; Just include that after you include jquery.js then do the following: $(#content h2).each(function(){ $(this).nextUntil(h2).wrap(div class='note'/div); }); Just 3 lines! Not too shabby :) --John On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Hi everyone. I am attempting to develop some dynamic in page navigation. I am a big fan of structural markup. Each H2 represents a new section of the current document. I wish to: 1. Find each H2 2. Wrap this in a unique div, up to (but not including) the next H2. This will then be used to further manipulate the page div id=content h2First section/h2 ...[arbitary HTML] h2second section/h2 ...[arbitary HTML] h2third section/h2 . /div Becomes: div id=content div id=1 h2First section/h2 ...[arbitary HTML] /div div id=2 h2second section/h2 ...[arbitary HTML] /div h2third section/h2 . /div Here is the JQuery that I have developed to date: $(document).ready(function(){ BuildNav(); }); /*BUILD SIDE NAVIGATION*/ function BuildNav() { //add back to top links before each H2 $('#content h2').each(function(i){ if(i==0){//FIRST H2 $(this).before('div id='+ i +' class=note')//START A NEW DIV WITH UNIQUE ID } else { $(this).before('/divdiv id='+ i +' class=note');//TERMINATE PREVIOUS DIV, BEGIN NEW ONE } }) $('#content').append('/div');//TERMINATE FINAL DIV } This looks sensible to me but fails. It appears you cannot inject unterminated tags and that JQUERY automatically closes tags on insertion, resulting in: div id=content div id=1/div h2First section/h2 ...[arbitary HTML] div id=2/div h2second section/h2 ...[arbitary HTML] div id=3/div h2third section/h2 . /div Can anyone give me any clues? Thanks in advance, Greg Bird ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/Quoted from: http://www.nabble.com/Please-help%21-Dynamically-Wrapping-DIV%27s-around-structural-markup.-tf2464168.html#a6869443--View this message in context: http://www.nabble.com/Please-help%21-Dynamically-Wrapping-DIV%27s-around-structural-markup.-tf2464168.html#a6870422Sent from the JQuery mailing list archive at Nabble.com. ___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery API discussion
Hi, The first time I saw line 1, I had no clue what it was doing. If all it's doing is running some jquery before the page is loaded, there's _got_ to be a more intuitive, succinct way to say it. That is not, what it is doing. It calls the callback-function as soon as the document is loaded and - if possible - before the Objects included in the page (like Images, etc.) are loaded. You can read $(document).load(function() {...}) like: as soon as the _document_ is _loaded_ execute this _function_. But function() { is just too frikin' weird No, that is the way, it works. Just read it like: as soon as _a#shownote_ is _clicked_ execute this _function_ Readability for people who are relatively new is particularly poured in for the world of JavaScript. Well, CSS is not that readable as well - actually in my view it is even worse. I have the impression that you were able to learn it. That makes me rather confident, that you can also learn JavaScript. It isn't really that complicated - you already have the best tool to make it easier for you: jQuery. Lots of people add a little JavaScript to a page and then don't do much more coding for another couple of months. Well, then they should listen to the german yellow-pages-advertisements: He should have asked someone who knows the ropes. Sorry, but if I (as a programmer) only design a Logo once in a while I ask someone else to do it. Not that I could't lean how to do it - I'm actually rahter good at painting and my taste isn't that bad as well, it is just that I don't whant to invest the time for learning and don't expect fried doves to fly into my mouth. JQuery makes your life a lot easier, but you can't programm without programming - even with jQuery. Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Please help (again, sorry)..NextUntil not working
Thanks for this Blair.a really interesting approach and one I wouldn't have thought of myself. At the moment, I am having problems with the NextUntil function, but once I have this solved, your suggestion may be a really neat implementation. Cheers, Greg Blair McKenzie-2 wrote: This is just a guess: function BuildNav() { $(#content h2).each(function(){ $(this).before(div class='note newdivmarker'/div).nextUntil(h2).appendTo(.newdivmarker); $( div.newdivmarker).removeClass(newdivmarker); }); } It relies on the assumption that appendTo moves the origonal element list, rather than clones them. Basically: 1. It adds your div before the heading, with a temporary marker so we can find it again 2. Selects all elements until the next heading 3. Moves them to the div 4. Removes the marker from the div Blair On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Hi John, thanks again for your help, unfortunately I have deployed your suggestions and am still unable to get it to work. You can view my testpage at: http://members.optusnet.com.au/greg.bird/mm/collapse.html My .js now reads: $(document).ready(function(){ BuildNav(); }); //DEFINE NextUntil FUNCTION $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } console.log(this,cur,match); }); return this.pushStack( match, arguments ); }; /*BUILD SIDE NAVIGATION*/ function BuildNav() { $(#content h2).each(function(){ $(this).nextUntil(h2).wrap(div class='note'/div); }); } I have logged the script and it appears that the match array is not being populated. I suspect that the Jquery.merge function is not triggering properly Does this function work with JQUERY 1.0.2? In note in the JQUERY doco that the function call is now $.merge. Trialled this without success. My aim here is to put a unique div around each section of the page and then dynamically create an expand/collapse navigation system. Have already achieved a similar result with a sliding navigation system. You can see this at: http://members.optusnet.com.au/greg.bird/mm/index.html This was easier as I didn't need to wrap div's around anything, but simply anchor to the existing H2's Have you got any suggestions? Do you have any test pages so that I can view your implementation? Thanks in advance, Greg John Resig wrote: Hi Greg - I created a plugin a while back that can help with this, called nextUntil: $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } }); return this.pushStack( match, arguments ); }; Just include that after you include jquery.js then do the following: $(#content h2).each(function(){ $(this).nextUntil(h2).wrap(div class='note'/div); }); Just 3 lines! Not too shabby :) --John On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Hi everyone. I am attempting to develop some dynamic in page navigation. I am a big fan of structural markup. Each H2 represents a new section of the current document. I wish to: 1. Find each H2 2. Wrap this in a unique div, up to (but not including) the next H2. This will then be used to further manipulate the page div id=content h2First section/h2 ...[arbitary HTML] h2second section/h2 ...[arbitary HTML] h2third section/h2 . /div Becomes: div id=content div id=1 h2First section/h2 ...[arbitary HTML] /div div id=2 h2second section/h2 ...[arbitary HTML] /div h2third section/h2 . /div Here is the JQuery that I have developed to date: $(document).ready(function(){ BuildNav(); }); /*BUILD SIDE NAVIGATION*/ function BuildNav() { //add back to top links before each H2 $('#content h2').each(function(i){ if(i==0){//FIRST H2 $(this).before('div id='+ i +' class=note')//START A NEW DIV WITH UNIQUE ID } else { $(this).before('/divdiv id='+ i +' class=note');//TERMINATE PREVIOUS DIV, BEGIN NEW ONE } }) $('#content').append('/div');//TERMINATE FINAL DIV } This looks sensible to me but fails. It appears you cannot inject unterminated tags and that JQUERY automatically closes tags on insertion, resulting in: div id=content div id=1/div h2First section/h2 ...[arbitary HTML] div id=2/div h2second section/h2 ...[arbitary HTML] div id=3/div h2third section/h2 . /div Can anyone
Re: [jQuery] jQuery API discussion
Anders,I have to disagree with your view about the readability of jquery. I have little to no knowledge of _javascript_...and the only reason that I started using jquery is because it is so simple to understand the basics (prototype and dojo are a foreign language to mebut jquery is plain and simple).if you can read a stylesheet, then you can surely take the first steps in using jquery to add some pizzaz to your sitethen the rest is up to the individual...if you want to take the timeout to read and learn, both from the mailing list and by looking at the plug ins that have been contributed..you can take the next steps forward...jquery makes writing _javascript_ easy.it does not do things for you automatically... regardsGiuliano MarcangeloOn 17/10/06, Anders Schneiderman [EMAIL PROTECTED] wrote: Hi JornjQuer,As a newbie, my impression is that overall it's a _lot_ simpler and sleeker than say prototype.And I love the compactness of the language.However, there are a few aspects that will throw off new folks -- particularly graphic designers who don't have a programming background -- that they encounter right from the beginning.If more advanced features, which few people will use until they've been working in jquery for a while, seem a bit arcane, that's OK.But to do almost anything, you run into code that looks like this: 1 $(document).ready(function(){2 $(a#shownote).click(function(){3 $('#note').fadeIn(slow);4 });The first time I saw line 1, I had no clue what it was doing.If all it's doing is running some jquery before the page is loaded, there's _got_ to be a more intuitive, succinct way to say it. Ditto for line 2's click(function().If I know CSS, I can guess what a#shownote does.I can guess what click does.But function() { is just too frikin' weird for a newbie designer who's not been a programmer. Readability for people who are relatively new is particularly poured in for the world of _javascript_.Lots of people add a little _javascript_to a page and then don't do much more coding for another couple of months. The easier it is for new folks to get started with jquery, the closer we are to JWD (Jquery World Domination).Thanks,Anders SchneidermanService Employees International Union ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Intro + suggestion (plugin repository)
Hello, It's my first post, so let me introduce myself. I'm a jquery newbie, somewhat knowledgeable at javascript, php, and web applications in general. I'm the developer of thinkedit (www.thinkedit.org) yet another php CMS. We choosed jquery to add easily some dynamic behaviour to the admin interface of this cms. Currently, very little has been done in this direction. The main thing to do is to build a tree ui for the management of nodes inside the cms. This being said, I have a first question / proposal : is there a plan to have a solid plugin repository ? It would be great to have a central place where authors can add plugins, with structured informations : - author - last updated - compatibility with jquery version x and upper (very important if you plan to change the api) - user rating - user comments - svn access This looks like a lot of work, but this would help a lot. I'm always a bit in discomfort to copy and paste some plugin code from some unknown people on a production site. This would also help collaboration on plugins. Maybe I'm dreaming, or maybe it already exists, or maybe it's too early ? Anyway, thanks a lot for this refreshing way of using javascript ! -- Philippe Jadin Thinkedit, a flexible data and content management system : http://www.thinkedit.org ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Mouseover/out + CSS background image behavior changein IE between rev 249 and 413
Thanks for the information. I have posted a quick screencam of the problem here: using 249: http://www.ibx.cz/jq/old.htm using 413: http://www.ibx.cz/jq/new.htm The only difference between the two is the new version of JQuery. From: Brandon Aaron [EMAIL PROTECTED] Reply-To: jQuery Discussion. discuss@jquery.com To: jQuery Discussion. discuss@jquery.com Subject: Re: [jQuery] Mouseover/out + CSS background image behavior changein IE between rev 249 and 413 Date: Tue, 17 Oct 2006 12:45:00 -0500 On 10/17/06, Prague Expat [EMAIL PROTECTED] wrote: Is it possible that the memory leak fixes (that I understand are in the updated JQuery) are causing quick refreshes on the CSS? This is doubtful as the code that fixes the memory leak only runs at unload. -- Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ _ Get today's hot entertainment gossip http://movies.msn.com/movies/hotgossip?icid=T002MSN03A07001 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Mouseover/out + CSS background image behavior change in IE between r
That fixed it completely. Thank you very much! From: EJ12N [EMAIL PROTECTED] Reply-To: jQuery Discussion. discuss@jquery.com To: discuss@jquery.com Subject: Re: [jQuery] Mouseover/out + CSS background image behavior change in IE between r Date: Tue, 17 Oct 2006 18:56:18 -0700 (PDT) Hello, I believe this is IE background-image flickering problem you are experiencing... http://evil.che.lu/2006/9/25/no-more-ie6-background-flicker In jQuery code... //Stop IE flicker if ($.browser.msie == true) { document.execCommand('BackgroundImageCache', false, true); } -EJ Prague Expat wrote: Does JQuery try to refresh/reload any CSS on mouse events? In my version of IE (with JQuery rev 413) every mouseover/out is causing all my CSS background images to quickly reload (but not quickly enough, as it is quite noticeable). I did not have this problem with rev 249 (I just updated to 413 yesterday and noticed the strange behavior). One more thing: the dev PC at work does not show a problem with IE with either JQuery version. My home PC shows the problem with version 413 only. At home, 249 works perfectly but fails as soon as I try the 413 version. Is it possible that the memory leak fixes (that I understand are in the updated JQuery) are causing quick refreshes on the CSS? Thanks for any insight. Feel free to email be w/questions. pragueexpat (at) hotmail.com code: $(document).ready(function(){ //remove anchors in menu table tds - replace w/bkimg $(.menuanchor).remove(); $(#menutab1).css({backgroundImage:url(i/about.jpg),cursor:pointer}).rb_menu(); $(#menutab2).css({backgroundImage:url(i/practice.jpg),cursor:pointer}).rb_menu(); $(#menutab3).css({backgroundImage:url(i/offices.jpg),cursor:pointer}).rb_menu(); $(#menutab4).css({backgroundImage:url(i/tech.jpg),cursor:pointer}).rb_menu(); $(#menutab5).css({backgroundImage:url(i/patients.jpg),cursor:pointer}).rb_menu(); $(.links).click(function(){window.location=this.id+.php}); $(#logo).click(function(){window.location=/bho/index.php}); $(#newsbody).height($(#contentcol2).height()-111+px);});$.fn.rb_menu = function(options) {var self = this;this.options = {// transitions: easein, easeout, easeboth, bouncein, bounceout,// bounceboth, elasticin, elasticout, elasticbothtransition: 'easein',// trigger events: mouseover, mousedown, mouseup, click, dblclicktriggerEvent: 'mouseover',// number of ms to delay before hiding menu (on page load)loadHideDelay : 500, // number of ms to delay before hiding menu (on mouseout) blurHideDelay: 500,// number of ms for transition effect effectDuration: 500}// make sure to check if options are given! if(options) {$.extend(this.options, options);}return this.each(function() {var menu = $(#drop+this.id); menu.closed = true;menu.hide();menu.hide = function() { if(menu.css('display') == 'block' !menu.closed) { menu.BlindUp(self.options.effectDuration, function() {menu.closed = true; menu.unbind();}, self.options.transition);} $(.dropmenu li).css(fontWeight,normal);}menu.show = function() { if(menu.css('display') == 'none' menu.closed) { menu.BlindDown(self.options.effectDuration, function() {menu.closed = false; menu.hover(function() { clearTimeout(menu.timeout);}, function() { menu.timeout = setTimeout( function() { menu.hide();}, self.options.blurHideDelay); });},self.options.transition );} //highlight each li option on mouseover $(.dropmenuli).mouseover(function(){$(this).css({fontWeight:bold,color:white,background:#e6ccb3});}).mouseout(function(){$(this).css({fontWeight:normal,color:#a0a0a0,background:#f2e6da});}); }//show drop down when mouseover table tds self.bind(mouseover, function() { menu.show();}); //hide drop downs if mouseout of table tdsself.bind(mouseout, function() { menu.timeout = setTimeout( function() {menu.hide();},self.options.blurHideDelay);});});}; ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Mouseover-out-%2B-CSS-background-image-behavior-change-in-IE-between-rev-249-and-413-tf2460726.html#a6867990 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ _ Try the next generation of search with Windows Live Search today!
Re: [jQuery] ThickBox in Filemanager
PDFs in object tags have numerous problems and the widespread consensus is generally not to use such things. PDFs in iframes are possible (https://secure.marketech.us/php/framedemo/), and I might just retract what I said earlier if I can get a PDF to open in a thickbox iframe. Michael Geary wrote: Well, as I've already said, you won't be able to show the PDF in a thickbox, because the OS/browser will catch the link and try to open it using the default action set in the browser or OS, and there's nothing that you can do to override it. If no default action is set, then you -might- be able to open it in the browser. But let's be honest, the percentage of users without a PDF reader is pretty small (probably the same percentage as those browsing the web on an Amiga 1200. :-) As far as I know, there is no ability to read PDF's inline like you're trying to do, and trying to force PDFs to open in a small window just isn't practical, and users won't like it if you force it upon them. If you can load HTML into the thickbox, you can easily load a PDF file. Simply use an iframe or object tag. For some examples: http://www.google.com/search?num=100q=pdf+iframe http://www.google.com/search?num=100q=pdf+%22object+tag%22 -Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/ThickBox-in-Filemanager-tf2455670.html#a6871575 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Is there a way to reply to someone's post...
Blair McKenzie-2 wrote: You could use the Nabble archive Nabble seems a good solution. Thanks Blair. -- View this message in context: http://www.nabble.com/Is-there-a-way-to-reply-to-someone%27s-post...-tf2463061.html#a6871739 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selectors [EMAIL PROTECTED]|=val] and [EMAIL PROTECTED] Have they been removed?
John Resig schreef: Honestly, I've never seen anyone use the lang attribute - let alone have a need to select it using a CSS selector. Hence the reason for removing it. I've used the lang attribute of the html tag to extract the right language for the links in a multilingual top level navigation. This is the code i use var currentLang = $(html).eq(0).attr(lang); I change the lang attribute with php. by doing that the site is also semantically correct. we have three languages here so everything i do has to be at least multiple language ready. Some people use the things you least expect :) -- David Duymelinck [EMAIL PROTECTED] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selectors [EMAIL PROTECTED]|=val] and [EMAIL PROTECTED] Have they been removed?
David Duymelinck schrieb: John Resig schreef: Honestly, I've never seen anyone use the lang attribute - let alone have a need to select it using a CSS selector. Hence the reason for removing it. I've used the lang attribute of the html tag to extract the right language for the links in a multilingual top level navigation. This is the code i use var currentLang = $(html).eq(0).attr(lang); I change the lang attribute with php. by doing that the site is also semantically correct. we have three languages here so everything i do has to be at least multiple language ready. Some people use the things you least expect :) Yeah! I also use the attribute for an Open new window script that also adds a title (which of course is language dependent) to the links, that will open a new window. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Intro + suggestion (plugin repository)
Previous threads have brought this up and the response from John has been: It's in the works.BlairOn 10/18/06, Philippe Jadin [EMAIL PROTECTED] wrote:Hello,It's my first post, so let me introduce myself. I'm a jquery newbie, somewhat knowledgeable at _javascript_, php, and web applications ingeneral. I'm the developer of thinkedit (www.thinkedit.org) yetanother php CMS. We choosed jquery to add easily some dynamic behaviour to the admin interface of this cms. Currently, very littlehas been done in this direction. The main thing to do is to build atree ui for the management of nodes inside the cms.This being said, I have a first question / proposal : is there a plan to have a solid plugin repository ?It would be great to have a central place where authors can addplugins, with structured informations :- author- last updated- compatibility with jquery version x and upper (very important if you plan to change the api)- user rating- user comments- svn accessThis looks like a lot of work, but this would help a lot. I'm always abit in discomfort to copy and paste some plugin code from some unknown people on a production site. This would also helpcollaboration on plugins. Maybe I'm dreaming, or maybe it alreadyexists, or maybe it's too early ?Anyway, thanks a lot for this refreshing way of using _javascript_ ! --Philippe JadinThinkedit, a flexibledata and contentmanagement system :http://www.thinkedit.org___ jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Thickbox Extensions - Dialog Monolog [REPOST]
Loving it loving it! I called my creation jAlert, which has similar functionality, but I never implemented the monolog. bbuchs wrote: [Original message ended up in the API Discussion thread - sorry!] I'm a big, big fan of Cody's Thickbox script. I'm using it for a web app I've been building, and it's fantastic. I wanted/needed a script that worked similarly for custom dialog boxes (OK/Cancel). Since Thickbox was already doing most of the heavy lifting, I wrote up some functions that tap into it and handle the dialogs. Something else I've been working on is a Monolog box, which I read about on the Humanized weblog [1]. Essentially, it's for displaying a transient status message to the user that doesn't really require any input. Again, I tapped into Thickbox for this one. Demos and source files are available at: http://bryanbuchs.com/tb_dialog/ Feedback Suggestions welcomed. - Bryan --- [1] http://www.humanized.com/weblog/2006/09/11/monolog_boxes_and_transparent_messages/ -- View this message in context: http://www.nabble.com/Thickbox-%22Extensions%22---Dialog---Monolog--REPOST--tf2455591.html#a6872932 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] SOT: PNG fix seems to cause page to load endlessly
That worked perfectly Klaus...thank you. !//-- 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 Andy Matthews Sent: Tuesday, October 17, 2006 11:21 AM To: jQuery Discussion. Subject: Re: [jQuery] SOT: PNG fix seems to cause page to load endlessly I see...thank you Klaus. I'll read up on that link you sent. Appreciated. !//-- 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 Klaus Hartl Sent: Tuesday, October 17, 2006 10:51 AM To: jQuery Discussion. Subject: Re: [jQuery] SOT: PNG fix seems to cause page to load endlessly Andy Matthews schrieb: I'll check into this, but I don't believe we're using transparent backgrounds. I'm pretty sure we're just using product images which are in plain IMG tags. That is exactly what this solution relies on. Nonetheless the transparent png is set in CSS by usage of the alphaimageloader filter... -- Klaus ___ 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] How to bind a function only once
I have a group of checkboxes, and as long as any one of the boxes is checked I need a function bound to a select list, but anytime none of the boxes are checked I need the function unbound. What I have below binds and unbinds, but if I select lets say 4 checkboxes the function is bound and called 4 times when I change my select list. How do I just bind it once? $('[EMAIL PROTECTED]').click(function(){ if($([EMAIL PROTECTED]'label_checkbox']).is(:checked)) { $('#label').bind('change', function(){ alert('test'); }); } else { $('#label').unbind('change'); } }); -- View this message in context: http://www.nabble.com/How-to-bind-a-function-only-once-tf2466835.html#a6876978 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] SVN and firewall issues
Hi,I'd love to be able to work with the latest jQuery code. However, in the infinite wisdom of the network admins at work, they don't allow access to external svn: urls. With the old jQuery svn web interface I could download a zipped up file containing the most recent revision, but I can't find that on the new site. Does anyone know if there is such a thing still, or if not if there is another way for me to get updated code other than using SVN at home and remembering to put it on a thumb drive or something. Thanks,Paul ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] SVN and firewall issues
I feel your pain... ours (or rather one in particular) don't even allow SVN over HTTP (the HTTP methods it requires are blocked). It is not business critical (would just make my life easier as I would be able to try out more open source applications and maybe even contribute), so unlikely to get unblocked. My understanding is that if WebDav works, so will SVN (over http). I think they just don't understand developers (i.e. no programming experience and don't even know what version control or SVN is) and more often than not seem to be anti-open source (or anti anything that isn't made by Microsoft). I would have through Trac had away of doing this (something like appending ?format=zip to the URL). On 18/10/06, Paul McLanahan [EMAIL PROTECTED] wrote: Hi, I'd love to be able to work with the latest jQuery code. However, in the infinite wisdom of the network admins at work, they don't allow access to external svn: urls. With the old jQuery svn web interface I could download a zipped up file containing the most recent revision, but I can't find that on the new site. Does anyone know if there is such a thing still, or if not if there is another way for me to get updated code other than using SVN at home and remembering to put it on a thumb drive or something. Thanks, Paul ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Submitting a form after input type=file onchange
Hello, This is my first post to the list. I am still new to jQuery and so far I think it is the best lib available. You guys rock! Anyways, I have a question regarding a form I am trying to submit using jQuery. I was using an inline onchange event to trigger the form submit for an file input box. Here is the html and js: $(document).ready(function() { $(#file).change(function() { alert(change); uploadPhoto(); });});var uploadPhoto = function() { $(/html/body/div/form).submit(function() { alert(inside); });}form name=photo id=photo-upload-form action=/ method=get enctype=multipart/form-datadivlabel for=imageFind Your Photo/labelinput id=file type=file name=image //div/form I can get an alert to fire inside the uploadPhoto function, but not inside the submit function. I was worried that I wasnt targeting the form correctly, so I used firebug to find the XPath to it. I am not sure why it isnt working. Thanks, Marshall ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] SVN and firewall issues
@SamYup.. I'm in that boat as well. HTTP svn attempts fail complaining about PROPFIND. The only svn access I've ever gotten to work is HTTPS. I can get to projects hosted on Google Code like that, but unless a project has a cert and allows HTTPS access to the repo, I'm out of luck. I'm going to try submitting a request to open this stuff, but I seriously doubt they'll do anything about it. I know it'd be trivially easy to have a post commit script generate a tar.gz of the repo and move it to a spot on the web server for easy download. I'd be happy to create such a script if I knew the paths involved. If any of the jQueriers wants my help on any of this I'd be more than happy to donate some time. PaulOn 10/18/06, Sam Collett [EMAIL PROTECTED] wrote: I feel your pain... ours (or rather one in particular) don't evenallow SVN over HTTP (the HTTP methods it requires are blocked). It isnot business critical (would just make my life easier as I would beable to try out more open source applications and maybe even contribute), so unlikely to get unblocked. My understanding is that ifWebDav works, so will SVN (over http).I think they just don't understand developers (i.e. no programmingexperience and don't even know what version control or SVN is) and more often than not seem to be anti-open source (or anti anything thatisn't made by Microsoft).I would have through Trac had away of doing this (something likeappending ?format=zip to the URL). ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Jquery.css function poor performance
After further tests I realize that most of the time is spent in getting the height and width of the passed element: oHeight = e.offsetHeight;oWidth = e.offsetWidth; Since this calculated by the browser I don't think there's much to do. What do you think? I'm using IE 6; I don't know if the same delay is present in other browsers (probably it is). Do you know of a more efficient way to get the width/height of an element; otherwise I can only think on doing some caching of these values. Thanks On 10/17/06, Brandon Aaron [EMAIL PROTECTED] wrote: Would it be possible for you to post a link so that we can see it orat least maybe just a test case? --Brandon AaronOn 10/17/06, Raziel Alvarez [EMAIL PROTECTED] wrote: Hi, I'm performing css manipulation in my application, but the performance degrades considerably fast as more markup is added. I tracked the problem to the jQuery.css function, specifically for those cases where I'm setting the width and height. Even small additions to the markup inside of the container to which I want to set the width and height produce a big increase in the delay of such function. I took a quick look at the implementation and they seem to be special cases, and since I don't quite get the logic inside I don't feel comfortable changing it. My application is getting to the point of being useless because of the delay. Is there a plan to fix this in the next release? Is there any way this can be improved meanwhile? Regards, ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submitting a form after input type=file onchange
You're nearly there. You've just got a slight problem in your understanding of what the $().submit(func) function does. What you're doing is adding an onsubmit handler to the form whenever the contents of the file input element is changed. But, that function won't fire until the form is actually submitted. I implemented your code, and the inside alert pops up just fine when I added a submit input element and used it. If you want it to submit automatically when you've changed the file input, add another empty .submit() function after the one you have. Your new function will look like this: $(form#photo-upload-form) .submit(function() {alert(inside);}) .submit();Of course, if you just wanted the form to autosubmit, just remove your function from inside the first .submit() call and it will submit the form. In the form above it will allow you to run some arbitrary code before the submission. I also changed your query from the xpath to the ID of the form tag. Why not use it since it was already there.On 10/18/06, Marshall Salinger [EMAIL PROTECTED] wrote: Hello, This is my first post to the list. I am still new to jQuery and so far I think it is the best lib available. You guys rock! Anyways, I have a question regarding a form I am trying to submit using jQuery. I was using an inline onchange event to trigger the form submit for an file input box. Here is the html and js: $(document).ready(function() { $(#file).change(function() { alert(change); uploadPhoto(); });});var uploadPhoto = function() { $(/html/body/div/form).submit(function() { alert(inside); });} form name=photo id=photo-upload-form action= / method=get enctype=multipart/form-data divlabel for=imageFind Your Photo/ labelinput id=file type=file name=image //div /form I can get an alert to fire inside the uploadPhoto function, but not inside the submit function. I was worried that I wasn't targeting the form correctly, so I used firebug to find the XPath to it. I am not sure why it isn't working. Thanks, Marshall ___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/-- /IRS - fairtax.org ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submitting a form after input type=file onchange
$(form#photo-upload-form) .submit(function() {alert(inside);}) .submit(); That won't work. You have to get out the DOM node out of the jQuery object first before calling submit() on it: $(#photo-upload-form) .submit(function() {alert(inside);}) [0].submit(); ^^^ You have to be always careful with such code. Once the element #photo-upload-form is not found for whatever reason an error will be thrown, because yor are calling a function on undefined. Speaking of optimizing queries, leave away the element type form in front of your id selector as well. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Checking select option has class?
Hi all, Thanks to IE's wonderful ommission of disabled="disabled" for options in select drop downs, I need to add a class to disabled options and and check for that class when the form is submitted. How doI check the selected option has a class within a select? if($('#myselect').get(0).hasClass("disabled") ){ //don't submit the form } ??? TIA. Luc PestilleWeb Designer e: [EMAIL PROTECTED]t: +44 (0)1628 899 700f: +44 (0)1628 899 701 In2Thames HouseMere ParkDedmere RoadMarlowBucksSL7 1PBTel 01628 899700Fax 01628 899701e: [EMAIL PROTECTED]i: www.in2.co.ukThis message (and any associated files) is intended only for the use of discuss@jquery.com and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not discuss@jquery.com you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored. Any views or opinions presented are solely those of the author [EMAIL PROTECTED] and do not necessarily represent those of the company. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submitting a form after input type=file onchange
Thanks Klaus and Paul, I was getting errors on the empty submit call. It works now. Thanks! -Marshall -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Klaus Hartl Sent: Wednesday, October 18, 2006 8:41 AM To: jQuery Discussion. Subject: Re: [jQuery] Submitting a form after input type=file onchange $(form#photo-upload-form) .submit(function() {alert(inside);}) .submit(); That won't work. You have to get out the DOM node out of the jQuery object first before calling submit() on it: $(#photo-upload-form) .submit(function() {alert(inside);}) [0].submit(); ^^^ You have to be always careful with such code. Once the element #photo-upload-form is not found for whatever reason an error will be thrown, because yor are calling a function on undefined. Speaking of optimizing queries, leave away the element type form in front of your id selector as well. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Interface - dragging nodes containing text areas (Firefox, Safari)
I've got an issue with using the Interface idrag.js. The Interface website implies I should be asking here for support issues.I have a DOM structure that contains, amongst other things, a text field and a textArea. What I find when I drag the object in Firefox is that any text I might have typed into the textArea disappears, and when I stop the drag it re-appears.I have dug into the idrag.js source and found that it works by doing a cloneNode(true) on the object being dragged and hiding the original. That cloned node is then appended to a dragHelper at the top level of the HTML tree, presumably to avoid having to deal with issues of dragging things from deeper structures and calculating drop positions, etc. Whatever the reason, what I see (using the DOM inspector from the web developer toolbar for Firefox) is that the node tree is correctly cloned, except that the "value" property of the textArea is not replicated. Hence the cloned drag object has no text in it.The problem is worse in Safari as the text field text also disappears during the drag. In IE it all works fine (not often you hear those words :-)A further wrinkle is that if the original text area contained initial text within tag (e.g. "textarea class='text' rows="8"flibble/textarea") then that text (in this case "flibble") appears during the drag, even if I have typed new text into the textArea before dragging.Has anyone else come across this problem and found any way of addressing it? If there is no easy fix then I'll probably have to change the Interface drag code itself.Doug___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Jquery.css function poor performance
After further tests I realize that most of the time is spent in getting the height and width of the passed element: oHeight = e.offsetHeight; oWidth = e.offsetWidth; As Brandon says, please post a link to a test page so we can take a look. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to bind a function only once
I have a group of checkboxes, and as long as any one of the boxes is checked I need a function bound to a select list, but anytime none of the boxes are checked I need the function unbound. What I have below binds and unbinds, but if I select lets say 4 checkboxes the function is bound and called 4 times when I change my select list. How do I just bind it once? $('[EMAIL PROTECTED]').click(function(){ if($([EMAIL PROTECTED]'label_checkbox']).is(:checked)) { $('#label').bind('change', function(){ alert('test'); }); } else { $('#label').unbind('change'); } }); I would bind the event once, then look at the check boxes when the event occurs. $('#label').bind('change', function(){ if($([EMAIL PROTECTED]'label_checkbox']).is(:checked)) { alert('test'); } }); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Please help (again, sorry)..NextUntil not working
Ok, I did some more digging and you're right. I don't think I ever actually tested nextUntil (oops!) The full implementation can be found here: http://john.jquery.com/jquery/test/nextuntil.html This includes a working version of nextUntil: $.fn.nextUntil = function(expr) { var match = []; // We need to figure out which elements to push onto the array this.each(function(){ // Traverse through the sibling nodes for( var i = this.nextSibling; i; i = i.nextSibling ) { // Make sure that we're only dealing with elements if ( i.nodeType != 1 ) continue; // If we find a match then we need to stop if ( jQuery.filter( expr, [i] ).r.length ) break; // Otherwise, add it on to the stack match.push( i ); } }); return this.pushStack( match, arguments ); }; Additionally, I realized that .wrap() isn't going to do what you need it to. .wrap() wraps each matched element with the same structure. So if you matched 3 paragraphs, you'd have three surrounding divs too. Since you want it to wrap all of the matched elements with a single element, I made a new .wrapAll() plugin: $.fn.wrapAll = function() { // There needs to be at least one matched element for this to work if ( !this.length ) return this; // Find the element that we're wrapping with var b = jQuery.clean(arguments)[0]; // Make sure that its in the right position in the DOM this[0].parentNode.insertBefore( b, this[0] ); // Find its lowest point while ( b.firstChild ) b = b.firstChild; // And add all the elements there return this.appendTo(b); }; So - all of that should help you along now. Let me know if this works for you. --John On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Thanks for this Blair.a really interesting approach and one I wouldn't have thought of myself. At the moment, I am having problems with the NextUntil function, but once I have this solved, your suggestion may be a really neat implementation. Cheers, Greg Blair McKenzie-2 wrote: This is just a guess: function BuildNav() { $(#content h2).each(function(){ $(this).before(div class='note newdivmarker'/div).nextUntil(h2).appendTo(.newdivmarker); $( div.newdivmarker).removeClass(newdivmarker); }); } It relies on the assumption that appendTo moves the origonal element list, rather than clones them. Basically: 1. It adds your div before the heading, with a temporary marker so we can find it again 2. Selects all elements until the next heading 3. Moves them to the div 4. Removes the marker from the div Blair On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Hi John, thanks again for your help, unfortunately I have deployed your suggestions and am still unable to get it to work. You can view my testpage at: http://members.optusnet.com.au/greg.bird/mm/collapse.html My .js now reads: $(document).ready(function(){ BuildNav(); }); //DEFINE NextUntil FUNCTION $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } console.log(this,cur,match); }); return this.pushStack( match, arguments ); }; /*BUILD SIDE NAVIGATION*/ function BuildNav() { $(#content h2).each(function(){ $(this).nextUntil(h2).wrap(div class='note'/div); }); } I have logged the script and it appears that the match array is not being populated. I suspect that the Jquery.merge function is not triggering properly Does this function work with JQUERY 1.0.2? In note in the JQUERY doco that the function call is now $.merge. Trialled this without success. My aim here is to put a unique div around each section of the page and then dynamically create an expand/collapse navigation system. Have already achieved a similar result with a sliding navigation system. You can see this at: http://members.optusnet.com.au/greg.bird/mm/index.html This was easier as I didn't need to wrap div's around anything, but simply anchor to the existing H2's Have you got any suggestions? Do you have any test pages so that I can view your implementation? Thanks in advance, Greg John Resig wrote: Hi Greg - I created a plugin a while back that can help with this, called nextUntil: $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } }); return
[jQuery] Setting Height in FF
I am having some trouble in FF 1.5.0.7 on Win XP.It works in IE but not in FF. Am I doing this wrong? Is there a workaround?GlenCode Snippet: script$(document).ready(function() { var rightHeight = $(#right).height(); $(#left).height(rightHeight);}); /script style #left { border: 1px solid red; float:left; width: 200px } #right { border: 1px solid red; float:left; width: 200px } /style /head body div id=leftthis is the left /divdiv id=right this is the rightthis is the rightbr /this is the rightthis is the rightbr / this is the rightthis is the rightbr / this is the rightthis is the rightbr /this is the rightthis is the rightbr / this is the rightthis is the rightbr //div ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selectors [EMAIL PROTECTED]|=val] and [EMAIL PROTECTED] Have they been removed?
On 10/18/06, John Resig [EMAIL PROTECTED] wrote: Hi Choan - Hi John, thanks for answering. * Attribute selector [EMAIL PROTECTED] doesn't work (returns any element with a class name) * Attribute selector [EMAIL PROTECTED]|=en] doesn't work (returns any element with a hreflang attribute) Has the support for these selectors been removed? Yes, I removed support for those selectors, since they're virtually useless, in most respects. Finding an element by class is as simple as: foo.className Obviously I wasn't using the selector for checking for a class name ;) and the lang-related stuff seemed just silly - I've never seen an actual, practical use for it. Were you attempting to use them for something, or just curious? I was thinking about the possibility of creating a new selector for a quite strange markup I'm working on. As I saw the `:anything` has been extended by plugins, I thought it'd be interesting to write my own extension to (punish me) use something like this: [EMAIL PROTECTED]|=pare] which should match both tr class=pare-0 / and tr class=fill-0 pare-1 / Anyway, I can select every `tr` and iterate through them, so... there is a workaround simpler than what I intended to do. But, forgetting that... there are two things that upset me: 1. Those two selectors were present in the docs at http://jquery.com/docs/Base/Expression/CSS/. (I've just edited that page.) 2. The behaviour is unexpected. If these selectors are not supported, they shouldn't match anything, instead of matching every element which has the attribute. -- Choan http://choangalvez.nom.es/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Checking select option has class?
Nope, that didn't work - I suspect (read:complete guess)because #myselect is the select element itself, not the option within it. Anyone else offer a solution? if($('#myselect').is(":disabled") ){ //don't submit the form } From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sam CollettSent: 18 October 2006 17:07To: jQuery Discussion.Subject: Re: [jQuery] Checking select option has class? On 18/10/06, Luc Pestille [EMAIL PROTECTED] wrote: Hi all, Thanks to IE's wonderful ommission of disabled="disabled" for options in select drop downs, I need to add a class to disabled options and and check for that class when the form is submitted. How doI check the selected option has a class within a select? if($('#myselect').get(0).hasClass("disabled") ){ //don't submit the form } ??? TIA. Luc PestilleWeb Designer e: [EMAIL PROTECTED]t: +44 (0)1628 899 700f: +44 (0)1628 899 701 In2Thames HouseMere ParkDedmere RoadMarlowBucksSL7 1PBTel 01628 899700Fax 01628 899701e: [EMAIL PROTECTED]i: www.in2.co.ukThis message (and any associated files) is intended only for the use of discuss@jquery.com and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not discuss@jquery.com you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored. Any views or opinions presented are solely those of the author [EMAIL PROTECTED] and do not necessarily represent those of the company. ___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/I think this should work: if($('#myselect').is(":disabled") ){ //don't submit the form } ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to bind a function only once
Hi Brian - Here is how I would change your code: $('[EMAIL PROTECTED]').click(function(){ $('#label').unbind('change'); if ( $([EMAIL PROTECTED]'label_checkbox']:checked).length ) $('#label').bind('change', function(){ alert('test'); }); }); By making it such that the change event is always unbound from the select, when a checkbox changes, you're guaranteed to never have more than one bound at a time. Hope this helps. --John On 10/18/06, Brian Litzinger [EMAIL PROTECTED] wrote: I have a group of checkboxes, and as long as any one of the boxes is checked I need a function bound to a select list, but anytime none of the boxes are checked I need the function unbound. What I have below binds and unbinds, but if I select lets say 4 checkboxes the function is bound and called 4 times when I change my select list. How do I just bind it once? $('[EMAIL PROTECTED]').click(function(){ if($([EMAIL PROTECTED]'label_checkbox']).is(:checked)) { $('#label').bind('change', function(){ alert('test'); }); } else { $('#label').unbind('change'); } }); -- View this message in context: http://www.nabble.com/How-to-bind-a-function-only-once-tf2466835.html#a6876978 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- John Resig http://ejohn.org/ [EMAIL PROTECTED] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Checking select option has class?
Luc Pestille schrieb: Nope, that didn't work - I suspect (read:complete guess) because #myselect is the select element itself, not the option within it. Anyone else offer a solution? if ( $('#myselect').is(:disabled) ){ //don't submit the form } $('#myselect option').is(:disabled).addClass('disabled'); -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Setting Height in FF
Glen, You need to append the px on the end. A call to $(#right).height(); simply returns the integer, to set height, according to the jquery-1.0.2 API, you need the px: script $(document).ready(function() { var rightHeight = $(#right).height(); $(#left).height(rightHeight + px); }); /script -- View this message in context: http://www.nabble.com/Setting-Height-in-FF-tf2467829.html#a6880321 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Fix found for Interface plugin library (Sortables)
Is this the right forum to post the fix? I didn't find any contact info on the interface site: http://interface.eyecon.ro/ -Ed ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Handling unsupported browsers
Does anyone have a preferred way for handling browsers that are not officially supported by jQuery, such as Netscape? What I am planning on doing is having server-side browser detection code which gives me the browser name, platform, and version number, then in my site, having each page coded in two different ways: one for Ajax and one without Ajax. Is this what other people do? Does anyone have a browser-compatibility chart, where I can see which parts of jQuery work in the various browsers? Thank you, Mike Chabot ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Setting Height in FF
Ugh. Thank you!GlenOn 10/18/06, nezza [EMAIL PROTECTED] wrote: Glen,You need to append the px on the end.A call to $(#right).height(); simply returns the integer, to set height,according to the API, you need the px:script $(document).ready(function() { var rightHeight = $(#right).height();$(#left).height(rightHeight + px);});/script--View this message in context: http://www.nabble.com/Setting-Height-in-FF-tf2467829.html#a6880321Sent from the JQuery mailing list archive at Nabble.com.___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Handling unsupported browsers
The jQuery philosophy has made it much easier to deal with downlevel browsers for me. When I need compatibility, I build the page as I would if I weren't using javascript at all. Links all have hrefs to relevant places, elements that should be updated dynamically are filled with data on the server side, etc. Once I'm to that point, I start making jQuery do the cool things. The browsers that can support it get setup within the .ready() event. As an example, one of the sites I work on has a number of journals that need to be featured on the frontpage. The new version will have a little tabbed control that updates a headline list. The tabs themselves are completely functional without javascript, they simply have hrefs to each individual journal. With jQuery enabled, my super special function grabs that href, alters it to get a json result, then uses that to reload the headlines. The advantage to this approach is: you end up with semantically appropriate HTML, and the dynamic functionality is decoupled from the page markup. You won't find a href=# anywhere. :) So, in summary: build the downlevel functionality first, add the cool stuff on top of that. You'll get cleaner HTML, and it will degrade gracefully. -Kurt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Chabot Sent: Wednesday, October 18, 2006 11:53 AM To: discuss@jquery.com Subject: [jQuery] Handling unsupported browsers Does anyone have a preferred way for handling browsers that are not officially supported by jQuery, such as Netscape? What I am planning on doing is having server-side browser detection code which gives me the browser name, platform, and version number, then in my site, having each page coded in two different ways: one for Ajax and one without Ajax. Is this what other people do? Does anyone have a browser-compatibility chart, where I can see which parts of jQuery work in the various browsers? Thank you, Mike Chabot ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Interface - dragging nodes containing text areas (Firefox, Safari)
I've got an issue with using the Interface idrag.js. ... what I see (using the DOM inspector from the web developer toolbar for Firefox) is that the node tree is correctly cloned, except that the value property of the textArea is not replicated. Hence the cloned drag object has no text in it. ... A further wrinkle is that if the original text area contained initial text within tag (e.g. textarea class='text' rows=8flibble/textarea) then that text (in this case flibble) appears during the drag, even if I have typed new text into the textArea before dragging. Has anyone else come across this problem and found any way of addressing it? Here's what the W3C says about cloneNode: Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 Most people would want dynamic property values to be copied as well, but it looks like FF uses the defaulted attributes; is the W3C is saying that's compliant behavior? (The sentence isn't very clear to me.) Firefox does something similar when you get .innerHTML on an element, it represents the default attributes and not the current state. The only workaround I can think of is to copy the dynamic values that got left behind right after cloning. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] åäö doesn't wo rk with load/loadIfModified
1. meta-tag inside sida1.html doesn't work. 2. i don't have access to the IIS admin so i can't change anything there... 3. i've used other ajax-functions (not jquery) to load ISO-8859-1-files the way i do now and that has worked fine... so why shouldn't jquery be able to do that also? /niklas Ⓙⓐⓚⓔ wrote: On 10/17/06, Steven Wittens [EMAIL PROTECTED] wrote: The meta tags for html documents are only a fallback for the real HTTP headers. HTTP headers always take precendence over meta tags. in other words, it's the server config or the application on the server. How it's done in your environment on iis, I don't know. does anyone? -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/-doesn%27t-work-with-load-loadIfModified-tf2355437.html#a6870642 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] newbie request / suggestion / neat thing
I don't SO much care about borders and images (though they'd be nice) as about anti-aliasing, without which i think many of the solutions look awful. however, hadn't seen yours, and it at least solves SOME of my problems. Seems, though, like it'd be good to have yours for a small solution and a Curvy-port for a big solution, if that makes sense. Thanks for the note! --Adrienne dave.methvin wrote: Mike Alsup has tweaked my original corner rounder so that it does any corner adornment you'd like, and it's only 4KB. It doesn't support borders or background images in the parent though, which Curvy and a few others do. But it's a high price to pay, IMO. http://www.malsup.com/jquery/corner/ Be aware that using a large radius on a lot of elements can insert hundreds of new elements into your document to implement the rounding effect. That will cause the page to start slowly and can also make later use of jQuery selectors slower. jQuery .corner() is pretty thrifty, as you can tell from the loading time of Mike's page which has a lot of examples. Compare that to the Ruzee Borders page, which has a lot more features but is also very slow to load when used liberally: http://www.ruzee.com/blog/ruzeeborders/ If you are seeing performance problems while using any of these rounding scripts, turn them off to see if they are the cause. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/newbie-request---suggestion---neat-thing-tf2460391.html#a6860046 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] åäö doesn't wo rk with load/loadIfModified
try loading the exact same file from the exact same location using jquery and using xmlhttp directly. in js dump the chars 1 by 1 in hex and int... you will find it's your server. OR I will be very surprised. good luck On 10/18/06, badtant [EMAIL PROTECTED] wrote: 1. meta-tag inside sida1.html doesn't work. 2. i don't have access to the IIS admin so i can't change anything there... 3. i've used other ajax-functions (not jquery) to load ISO-8859-1-files the way i do now and that has worked fine... so why shouldn't jquery be able to do that also? /niklas Ⓙⓐⓚⓔ wrote: On 10/17/06, Steven Wittens [EMAIL PROTECTED] wrote: The meta tags for html documents are only a fallback for the real HTTP headers. HTTP headers always take precendence over meta tags. in other words, it's the server config or the application on the server. How it's done in your environment on iis, I don't know. does anyone? -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/-doesn%27t-work-with-load-loadIfModified-tf2355437.html#a6870642 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] Jquery.css function poor performance
Brandon, I disagree with you. I've seen several cases where these two properties can take a second or two on documents with hundreds of nodes.I agree that a test case or example file is needed so the community can verify it and do something about it. -FranciscoOn 10/18/06, Brandon Aaron [EMAIL PROTECTED] wrote: The offsetHeight and offsetWidth properties are very fast. Since Ican't see the code I assume your element is display: none;. That iswhere the performance hit would take place, but even then it should beminimal and not noticeable. I'm thinking there is probably something else going on.--Brandon AaronOn 10/18/06, Raziel Alvarez [EMAIL PROTECTED] wrote: After further tests I realize that most of the time is spent in getting the height and width of the passed element:oHeight = e.offsetHeight;oWidth = e.offsetWidth; Since this calculated by the browser I don't think there's much to do. What do you think? I'm using IE 6; I don't know if the same delay is present in other browsers (probably it is). Do you know of a more efficient way to get the width/height of an element; otherwise I can only think on doing some caching of these values. Thanks On 10/17/06, Brandon Aaron [EMAIL PROTECTED] wrote: Would it be possible for you to post a link so that we can see it or at least maybe just a test case? -- Brandon Aaron On 10/17/06, Raziel Alvarez [EMAIL PROTECTED] wrote: Hi, I'm performing css manipulation in my application, but the performance degrades considerably fast as more markup is added. I tracked the problem to the jQuery.css function, specifically for those cases where I'm setting the width and height. Even small additions to the markup inside of the container to which I want to set the width and height produce a big increase in the delay of such function. I took a quick look at the implementation and they seem to be special cases, and since I don't quite get the logic inside I don't feel comfortable changing it. My application is getting to the point of being useless because of the delay. Is there a plan to fix this in the next release? Is there any way this can be improved meanwhile? Regards, ___ 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.comhttp://jquery.com/discuss/-- Francisco Britosoftware: http://nullisnull.blogspot.comphotography: http://www.flickr.com/photos/darkgoyleeverything else: http://brito.mindsay.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] best show/hide div code?
I initially tried the toggle() method but it didn't provide the correct functionality for this specific issue. stylo~ wrote: This seems so common, is there no toggle function? Btw, what is the best way to add little helpers like that to our own jquery? Rey Bango-2 wrote: Hey Andy, you can do something like this: $(document).ready(function() { $( "#type" ).change( function() { if ( $( this ).val() == "event" ) $("#zipCode").show(); else $("#zipCode").hide(); }) }); tr id="zipCode" td align="right"Zip Code of event/td tdinput type="text" name="zip" id="zipfield"/td /tr /table Andy Matthews wrote: I'm working on a mailing list manager and one of the options is to provide a zip code for emailing anyone in that area. I'd like to hide this field unless the user has selected the "Tour Date" option from a select field. The relevant code is below. The second TR (and it's contents) will be hidden by default using CSS, but I want to toggle it's display property when the user selects or deselects the "event" option in the "type" dropdown field. table tr class="formBG" td class="formlabel" align="right"Mailing Type/td td select name="type" option value="general"General Announcement/option option value="store"BCC Store Announcement/option option value="ckc"Clowndergarten Announcement/option option value="event"Event Announcement/option /select /td /tr tr class="formBG" td class="formlabel" align="right"Zip Code of eventbr class="smaller"for event announcement only/td tdinput type="text" name="zip" id="zipfield" class="zcinput"/td /tr /table How would I do this with jQuery? !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- ___ 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] Interface - dragging nodes containing text areas (Firefox, Safari)
Hmm, thanks for that. The clone is a deep clone so I would expect the result to include the text value. I think I'll have to work around this in the way you suggest (or perhaps modify the idrag.js to not use a clone). Doug On 18 Oct 2006, at 18:25, Dave Methvin wrote: I've got an issue with using the Interface idrag.js. ... what I see (using the DOM inspector from the web developer toolbar for Firefox) is that the node tree is correctly cloned, except that the value property of the textArea is not replicated. Hence the cloned drag object has no text in it. ... A further wrinkle is that if the original text area contained initial text within tag (e.g. textarea class='text' rows=8flibble/ textarea) then that text (in this case flibble) appears during the drag, even if I have typed new text into the textArea before dragging. Has anyone else come across this problem and found any way of addressing it? Here's what the W3C says about cloneNode: Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 Most people would want dynamic property values to be copied as well, but it looks like FF uses the defaulted attributes; is the W3C is saying that's compliant behavior? (The sentence isn't very clear to me.) Firefox does something similar when you get .innerHTML on an element, it represents the default attributes and not the current state. The only workaround I can think of is to copy the dynamic values that got left behind right after cloning. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Intro + suggestion (plugin repository)
Very good news! Having this kind of official repository would be a big plus for jquery vs the other frameworks. The infrastructure work already done for jquery is amazing Philippe On 10/18/06, Blair McKenzie [EMAIL PROTECTED] wrote: Previous threads have brought this up and the response from John has been: It's in the works. Blair -- Philippe Jadin Thinkedit, a flexible data and content management system : http://www.thinkedit.org ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Unable to bind click function in a dynamically created object?
hey gang-- i got a bit of a stumper for ya, trying to bind a function to the click event of each link in a dynamically generated list. i have a bunch of long content pages that we're breaking up into subpages, with a sidenav to navigate through them. the markup for each page is as follows: div class=page h3Page One Title/h3 p/p p/p /div div class=page h3Another Page Title/h3 p/p p/p /div here's the function that sets up the list of links and stuffs them into the sidenav. $('.page').each(function(i) { var title = $('h3',this).eq(0).text(); var link = $('lia href=#page'+(i+1)+''+title+'/a/li'); $('.sidenav ul').append(link); $('a',link).click(function() { alert(1); // $('.page',pages).hide(); // $(page).show(); }); }); $('.page').hide().eq(0).show(); it grabs the text of the first H3 in each section to use as the link text. it builds an LI element containing the link, then appends that to the sidenav. then it tries to assign a click handler to the link. i've commented out the functional part of the click function and just put in an alert for testing, but the function isn't firing when i click these links. am i missing something? thanks for any help, -p ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Handling unsupported browsers
Does anyone have a preferred way for handling browsers that are not officially supported by jQuery, such as Netscape? What I am planning on doing is having server-side browser detection code which gives me the browser name, platform, and version number, then in my site, having each page coded in two different ways: one for Ajax and one without Ajax. Is this what other people do? Server-side browser detection is unreliable due to User Agent spoofing. It's much better to just code your pages so that the JavaScript features are tacked on transparently, and have a usable alternative when JavaScript is turned off. That way, you can treat any broken browser as one which does not support JavaScript. You can use several tricks to do this in a relatively seamless way: 1) Define a global variable jsEnabled or something, which checks for required DOM functions. For example: var jsEnabled = document.getElementsByTagName document.createElement document.createTextNode document.documentElement document.getElementById; Then, you can augment this with browser-specific denials if there are still problems. 2) In the global scope (NOT in .ready()), you set a class on the html element: if (jsEnabled) { document.documentElement.className = 'js'; } 3) Then, you define a bunch of CSS rules with the ancestor selector html.js (e.g. html.js #myelement) where you apply the required styles for JavaScript-based features. This can include hiding collapsed section of the page, making Ajax widgets visible, etc. 4) Any additional changes that need to be made to the source document are done in $(document).ready(), but also only if (jsEnabled) is true. This gives you the best of both worlds: you avoid non-JavaScript users seeing useless widgets on the page or having inaccessible content, while JavaScript users don't see the page change drastically as soon as it finished loading. Remember: even with $(document).ready () there is the possibility of incremental rendering. Then, when you tell your users to turn on JavaScript or switch browsers, it's not an ultimatum: it's a choice for them, if they want a better user experience, but they can't still see and use your site. Steven Wittens ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] best show/hide div code?
On Oct 18, 2006, at 2:09 PM, Rey Bango wrote:I initially tried the toggle() method but it didn't provide the correct functionality for this specific issue.That's right; it doesn't provide functionality for onchange. .toggle() is for click only. From the API:"Toggle between two function calls every other click. Whenever a matched element is clicked, the first specified function is fired, when clicked again, the second is fired. All subsequent clicks continue to rotate through the two functions."stylo~ wrote:This seems so common, is there no toggle function? Btw, what is the best way to add little helpers like that to our own jquery? Rey Bango-2 wrote: Hey Andy, you can do something like this: $(document).ready(function() { $( "#type" ).change( function() { if ( $( this ).val() == "event" ) $("#zipCode").show(); else $("#zipCode").hide(); }) }); Zip Code of event ___Karl Swedbergwww.englishrules.comwww.learningjquery.com___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Unable to bind click function in a dynamically created object?
Pascal schrieb: hey gang-- i got a bit of a stumper for ya, trying to bind a function to the click event of each link in a dynamically generated list. i have a bunch of long content pages that we're breaking up into subpages, with a sidenav to navigate through them. the markup for each page is as follows: div class=page h3Page One Title/h3 p/p p/p /div div class=page h3Another Page Title/h3 p/p p/p /div here's the function that sets up the list of links and stuffs them into the sidenav. $('.page').each(function(i) { var title = $('h3',this).eq(0).text(); var link = $('lia href=#page'+(i+1)+''+title+'/a/li'); $('.sidenav ul').append(link); $('a',link).click(function() { alert(1); // $('.page',pages).hide(); // $(page).show(); }); }); $('.page').hide().eq(0).show(); it grabs the text of the first H3 in each section to use as the link text. it builds an LI element containing the link, then appends that to the sidenav. then it tries to assign a click handler to the link. i've commented out the functional part of the click function and just put in an alert for testing, but the function isn't firing when i click these links. am i missing something? thanks for any help, -p I see one thing that may cause the problem: your variable link is a jQuery object. This is passed as context a few lines later on, but you have to pass a DOM node as context to the $ function. Try this: $('a', link[0]).click(...); Or to overall shorten the code: var link = $('li ... /li').appendTo('.sidenav ul')[0]; $('a', link).click(...); Does that help? -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Handling unsupported browsers
Kurt, That is a great strategy and it should work in most cases. Here is my thinking of what a typical plan would be: 1. Load a page that works assuming Ajax is not available 2. Use the ready() function to hide the content that should be made fancier 3. Make an Ajax call to pull in the fancier code. Problem is, some Netscape browsers get past step 2, but either fail or crash on step 3, potentially leaving a missing section of the page or an angry user that has to restart their browser, only to encounter the same problem the next time around. The AjaxStart method executes, but the actual Ajax call ends up failing. That is why I think I need some browser detection so that the jQuery code is not there at all in these unsupported browsers. FYI, the specific code I am working on is just a double-select list, where the content of select list #2 depends on select list #1. It is nothing overly fancy, but enough people use Netscape 7+ that I need to come up with a work-around. Thank you, Mike Chabot http://www.teachers-teachers.com On 10/18/06, Kurt Mackey [EMAIL PROTECTED] wrote: The jQuery philosophy has made it much easier to deal with downlevel browsers for me. When I need compatibility, I build the page as I would if I weren't using javascript at all. Links all have hrefs to relevant places, elements that should be updated dynamically are filled with data on the server side, etc. Once I'm to that point, I start making jQuery do the cool things. The browsers that can support it get setup within the .ready() event. As an example, one of the sites I work on has a number of journals that need to be featured on the frontpage. The new version will have a little tabbed control that updates a headline list. The tabs themselves are completely functional without javascript, they simply have hrefs to each individual journal. With jQuery enabled, my super special function grabs that href, alters it to get a json result, then uses that to reload the headlines. The advantage to this approach is: you end up with semantically appropriate HTML, and the dynamic functionality is decoupled from the page markup. You won't find a href=# anywhere. :) So, in summary: build the downlevel functionality first, add the cool stuff on top of that. You'll get cleaner HTML, and it will degrade gracefully. -Kurt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Chabot Sent: Wednesday, October 18, 2006 11:53 AM To: discuss@jquery.com Subject: [jQuery] Handling unsupported browsers Does anyone have a preferred way for handling browsers that are not officially supported by jQuery, such as Netscape? What I am planning on doing is having server-side browser detection code which gives me the browser name, platform, and version number, then in my site, having each page coded in two different ways: one for Ajax and one without Ajax. Is this what other people do? Does anyone have a browser-compatibility chart, where I can see which parts of jQuery work in the various browsers? Thank you, Mike Chabot ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Unable to bind click function in a dynamically created object?
Mike Alsup schrieb: I see one thing that may cause the problem: your variable link is a jQuery object. This is passed as context a few lines later on, but you have to pass a DOM node as context to the $ function. The context arg can be a jQuery object. From the source: jQuery = function(a,c) { snip // Watch for when a jQuery object is passed at the context if ( c c.jquery ) return jQuery( c ).find(a); Wow, thanks Mike! That must be quite new? Didn't work for me a while back... -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Unable to bind click function in a dynamically created object?
Hi Pascal - I did a little bit of re-tooling and got it working: http://john.jquery.com/jquery/test/page.html Let me know if it helps. --John $('.page').each(function(i) { var title = $('h3',this).eq(0).text(); var link = $('lia href=#page'+(i+1)+''+title+'/a/li'); $('.sidenav ul').append(link); $('a',link).click(function() { alert(1); // $('.page',pages).hide(); // $(page).show(); }); }); $('.page').hide().eq(0).show(); it grabs the text of the first H3 in each section to use as the link text. it builds an LI element containing the link, then appends that to the sidenav. then it tries to assign a click handler to the link. i've commented out the functional part of the click function and just put in an alert for testing, but the function isn't firing when i click these links. am i missing something? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] How to safely get the clickTarget of an event?
Is there a jQuery way of getting an events click target? I tend to use those elements quite a bit, but getting them is a pain. J ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Unable to bind click function in a dynamically created object?
I see one thing that may cause the problem: your variable link is a jQuery object. This is passed as context a few lines later on, but you have to pass a DOM node as context to the $ function. The context arg can be a jQuery object. From the source: jQuery = function(a,c) { snip // Watch for when a jQuery object is passed at the context if ( c c.jquery ) return jQuery( c ).find(a); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Unable to bind click function in a dynamically created object?
ah, i'm sorry, i found the problem, in another function that is running on document.ready. (it's converting the sidenav into a rounded box by grabbing the html and recreating the div, so the click handlers are getting lost. it's an old function that i'll have to rewrite in a more JQ way.) -p On Oct 18, 2006, at 2:33pm, Klaus Hartl wrote: Pascal schrieb: hey gang-- i got a bit of a stumper for ya, trying to bind a function to the click event of each link in a dynamically generated list. i have a bunch of long content pages that we're breaking up into subpages, with a sidenav to navigate through them. the markup for each page is as follows: div class=page h3Page One Title/h3 p/p p/p /div div class=page h3Another Page Title/h3 p/p p/p /div here's the function that sets up the list of links and stuffs them into the sidenav. $('.page').each(function(i) { var title = $('h3',this).eq(0).text(); var link = $('lia href=#page'+(i+1)+''+title+'/a/li'); $('.sidenav ul').append(link); $('a',link).click(function() { alert(1); // $('.page',pages).hide(); // $(page).show(); }); }); $('.page').hide().eq(0).show(); it grabs the text of the first H3 in each section to use as the link text. it builds an LI element containing the link, then appends that to the sidenav. then it tries to assign a click handler to the link. i've commented out the functional part of the click function and just put in an alert for testing, but the function isn't firing when i click these links. am i missing something? thanks for any help, -p I see one thing that may cause the problem: your variable link is a jQuery object. This is passed as context a few lines later on, but you have to pass a DOM node as context to the $ function. Try this: $('a', link[0]).click(...); Or to overall shorten the code: var link = $('li ... /li').appendTo('.sidenav ul')[0]; $('a', link).click(...); Does that help? -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submitting a form after input type=file onchange
It did work. I tried it before submitting the suggestion. The jQuery submit() function works in 2 ways. If a function is passed it will set that function to the onsubmit handler, and if no arguments are passed, it will call the submit action on the elements. Your way will work as well due to the form element's built in submit function. But I believe that my way will not throw an error if the form element is not found because jQuery functions fail silently on and empty set, whereas using the [0] to get the dom element first will throw an error if it doesn't exist. Please let me know if I'm wrong though. I could very well be. Though, as I said, I did test my code before offering the suggestion.On 10/18/06, Klaus Hartl [EMAIL PROTECTED] wrote: $(form#photo-upload-form) .submit(function() {alert(inside);}) .submit();That won't work. You have to get out the DOM node out of the jQueryobject first before calling submit() on it: $(#photo-upload-form) .submit(function() {alert(inside);}) [0].submit(); ^^^You have to be always careful with such code. Once the element#photo-upload-form is not found for whatever reason an error will be thrown, because yor are calling a function on undefined.Speaking of optimizing queries, leave away the element type form infront of your id selector as well.-- Klaus___ jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selectors [EMAIL PROTECTED]|=val] and [EMAIL PROTECTED] Have they been removed?
I've used the lang attribute of the html tag to extract the right language for the links in a multilingual top level navigation. This is the code i use var currentLang = $(html).eq(0).attr(lang); I change the lang attribute with php. by doing that the site is also semantically correct. we have three languages here so everything i do has to be at least multiple language ready. Some people use the things you least expect :) Well, I don't doubt that people use the lang attribute as intended (considering that I've never made a non-english site) - however, there's certainly never been a need for the ~= selector - which is only remotely useful with lang-related attributes. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submitting a form after input type=file onchange
Paul McLanahan schrieb: It did work. I tried it before submitting the suggestion. The jQuery submit() function works in 2 ways. If a function is passed it will set that function to the onsubmit handler, and if no arguments are passed, it will call the submit action on the elements. Your way will work as well due to the form element's built in submit function. But I believe that my way will not throw an error if the form element is not found because jQuery functions fail silently on and empty set, whereas using the [0] to get the dom element first will throw an error if it doesn't exist. Please let me know if I'm wrong though. I could very well be. Though, as I said, I did test my code before offering the suggestion. Your code may have worked under certain circumstances. jQuery.submit() triggers any handlers that were attached via jQuery.submit(someFunction). If in the function someFunction the form gets submitted than it's going to work out. But this may change in the future. I think, John filed a bug, that jQuery.submit() should also call the built-in FormElement.submit() method if available. Not quite sure if I'm mixing up two different things here. At least there was another thread regarding this topic. If that has changed I really would have to know - it would have quite an impact on my project. John? -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Please help (again, sorry)..NextUntil not working
just wanted to pipe in here, i'm using $.nextUntil and $.wrapAll in the custom paginator i'm building and it worked great. thanks, john. -p On Oct 18, 2006, at 12:21pm, John Resig wrote: Ok, I did some more digging and you're right. I don't think I ever actually tested nextUntil (oops!) The full implementation can be found here: http://john.jquery.com/jquery/test/nextuntil.html This includes a working version of nextUntil: $.fn.nextUntil = function(expr) { var match = []; // We need to figure out which elements to push onto the array this.each(function(){ // Traverse through the sibling nodes for( var i = this.nextSibling; i; i = i.nextSibling ) { // Make sure that we're only dealing with elements if ( i.nodeType != 1 ) continue; // If we find a match then we need to stop if ( jQuery.filter( expr, [i] ).r.length ) break; // Otherwise, add it on to the stack match.push( i ); } }); return this.pushStack( match, arguments ); }; Additionally, I realized that .wrap() isn't going to do what you need it to. .wrap() wraps each matched element with the same structure. So if you matched 3 paragraphs, you'd have three surrounding divs too. Since you want it to wrap all of the matched elements with a single element, I made a new .wrapAll() plugin: $.fn.wrapAll = function() { // There needs to be at least one matched element for this to work if ( !this.length ) return this; // Find the element that we're wrapping with var b = jQuery.clean(arguments)[0]; // Make sure that its in the right position in the DOM this[0].parentNode.insertBefore( b, this[0] ); // Find its lowest point while ( b.firstChild ) b = b.firstChild; // And add all the elements there return this.appendTo(b); }; So - all of that should help you along now. Let me know if this works for you. --John On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Thanks for this Blair.a really interesting approach and one I wouldn't have thought of myself. At the moment, I am having problems with the NextUntil function, but once I have this solved, your suggestion may be a really neat implementation. Cheers, Greg Blair McKenzie-2 wrote: This is just a guess: function BuildNav() { $(#content h2).each(function(){ $(this).before(div class='note newdivmarker'/div).nextUntil(h2).appendTo (.newdivmarker); $( div.newdivmarker).removeClass(newdivmarker); }); } It relies on the assumption that appendTo moves the origonal element list, rather than clones them. Basically: 1. It adds your div before the heading, with a temporary marker so we can find it again 2. Selects all elements until the next heading 3. Moves them to the div 4. Removes the marker from the div Blair On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Hi John, thanks again for your help, unfortunately I have deployed your suggestions and am still unable to get it to work. You can view my testpage at: http://members.optusnet.com.au/greg.bird/mm/collapse.html My .js now reads: $(document).ready(function(){ BuildNav(); }); //DEFINE NextUntil FUNCTION $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } console.log(this,cur,match); }); return this.pushStack( match, arguments ); }; /*BUILD SIDE NAVIGATION*/ function BuildNav() { $(#content h2).each(function(){ $(this).nextUntil(h2).wrap(div class='note'/div); }); } I have logged the script and it appears that the match array is not being populated. I suspect that the Jquery.merge function is not triggering properly Does this function work with JQUERY 1.0.2? In note in the JQUERY doco that the function call is now $.merge. Trialled this without success. My aim here is to put a unique div around each section of the page and then dynamically create an expand/collapse navigation system. Have already achieved a similar result with a sliding navigation system. You can see this at: http://members.optusnet.com.au/greg.bird/mm/index.html This was easier as I didn't need to wrap div's around anything, but simply anchor to the existing H2's Have you got any suggestions? Do you have any test pages so that I can view your implementation? Thanks in advance, Greg John Resig wrote: Hi Greg - I created a plugin a while back that can help with this, called nextUntil: $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur]
Re: [jQuery] Submitting a form after input type=file onchange
I would like to just say that I thought it would work as: $(#myform).submit(); inside the onchange event, but it would never submit the form. Using $(#myform)[0].submit(); worked immediately. Thanks again for your help! -Marshall -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Klaus Hartl Sent: Wednesday, October 18, 2006 12:35 PM To: jQuery Discussion. Subject: Re: [jQuery] Submitting a form after input type=file onchange Paul McLanahan schrieb: It did work. I tried it before submitting the suggestion. The jQuery submit() function works in 2 ways. If a function is passed it will set that function to the onsubmit handler, and if no arguments are passed, it will call the submit action on the elements. Your way will work as well due to the form element's built in submit function. But I believe that my way will not throw an error if the form element is not found because jQuery functions fail silently on and empty set, whereas using the [0] to get the dom element first will throw an error if it doesn't exist. Please let me know if I'm wrong though. I could very well be. Though, as I said, I did test my code before offering the suggestion. Your code may have worked under certain circumstances. jQuery.submit() triggers any handlers that were attached via jQuery.submit(someFunction). If in the function someFunction the form gets submitted than it's going to work out. But this may change in the future. I think, John filed a bug, that jQuery.submit() should also call the built-in FormElement.submit() method if available. Not quite sure if I'm mixing up two different things here. At least there was another thread regarding this topic. If that has changed I really would have to know - it would have quite an impact on my project. John? -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] IE XML parsing problem
Angelo Sozzi schrieb: Hi, I've managed to finish my first plugin and re-learn javascript at the same time. So I'm not quite sure if this is a Javascript or jQuery issue. The plugin loads external content from HTML or XML data using an AJAX call to the file name generated from the LI element clicked. DEMO: http://www.sozzi.cn/jquery/fish.fn.trial3.html It works perfectly for the HTML variant but the XML fails in IE throwing a Object doesn't support this property or method error. It seems to happen in the XML call and parse function on the line finding the link within the XML object: (snip)... $.get(XMLurl, function(xml){ $(site, xml).each(function(){ // step through each 'site' xml node $(this).find(link).each(function(){ // find 'link' insidet the 'site' node and turn it into html settings.parsedXML += div class='link' +$(this).text()+ ; (snip) Any thoughts on what I'm doing wrong? You don't do anything wrong. This is a known bug: http://jquery.com/dev/bugs/bug/164/ Work is in progress on that I think... If it is not yet fixed in latest SVN, I can provide a hotfix - I ran into that as well :-) settings.parsedXML += div class='link' + (this.firstChild.data || $(this).text()) + ; -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] parent()
I want to insert a row above an element.Imagine that I have:tabletrtdinput type=text id=myElement //td/tr/table I want to creat a new structure that looks like this:table tr class=errorCell colspan=100 tdspan class=errorPlease correct the error/spanbr //td /tr tr tdinput type=text id=myElement //td /tr /tableHowever, this produces no visual effect: $('#myElement').parent('tr').before('trtd class=errorCell colspan=100span class=errorPlease correct the error/spanbr //td/tr'); If I change the code, I see my new row: $('#myElement').parent().parent() .before('trtd class=errorCell colspan=100span class=errorPlease correct the error/spanbr //td/tr');I don't like this since it's bound to a specific table arrangement.Does anyone have any hints or different solutions?Thanks,Derrek[Long time lurker, first time poster :)] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
However, this produces no visual effect: $('#myElement').parent('tr') .before('trtd class=errorCell colspan=100span class=errorPlease correct the error/spanbr //td/tr'); If I change the code, I see my new row: $('#myElement').parent().parent() .before('trtd class=errorCell colspan=100span class=errorPlease correct the error/spanbr //td/tr'); I don't like this since it's bound to a specific table arrangement. Does anyone have any hints or different solutions? What happens if you just do: $('#myElement').parent().before('tr.../tr'); It seems like something like that should work just fine. (The fact that .parent().parent() works kind of makes me suspicious) Do you have an example up anywhere of the problem in action? --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
But, to my mind, it makes sense to do $('#myElement').parent().parent() because the parent of the input is a td and the parent of the td is the tr. Or is that wrong? No, you're right - On first glance I thought it was td id=myElement ... /td sorry about that. Not sure why .parent('tr') didn't work, though. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
Hey John,Unfortunately, I don't have an example up.But, to my mind, it makes sense to do $('#myElement').parent().parent() because the parent of the input is a td and the parent of the td is the tr. Or is that wrong? DerrekOn 10/18/06, John Resig [EMAIL PROTECTED] wrote: However, this produces no visual effect:$('#myElement').parent('tr') .before('trtd class=errorCell colspan=100span class=errorPlease correct the error/spanbr //td/tr'); If I change the code, I see my new row: $('#myElement').parent().parent().before('trtd class=errorCell colspan=100span class=errorPlease correct the error/spanbr //td/tr'); I don't like this since it's bound to a specific table arrangement. Does anyone have any hints or different solutions? What happens if you just do:$('#myElement').parent().before('tr.../tr');It seems like something like that should work just fine. (The factthat .parent().parent() works kind of makes me suspicious) Do you have an example up anywhere of the problem in action?--John___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] How to make input readonly with jQuery in IE
I've found some inconsistent behavior in IE vs. FF and was wondering if someone might know a workaround.I have some form fields, for which the HTML is generated by a template system out of my control. I want to set some of the fields to readonly so I wrap them in a span that has a readonly class. The HTML looks like this: span class=readonlyinput type=textSome text/input/spanI have tried each of the following queries and none of them have the desired effect. Its like they aren't modifying the DOM. $(span.readonly input).attr(readonly, readonly); $(span.readonly input).attr(disabled, disabled); $(span.readonly input).focus(function() { $(this).blur(); });These work (with varying effects) in FF but not in IE. However if I manually put the attributes (or script) on an input field in IE it does work. I know I have the queryright because I did this $(span.readonly input).focus(function() { alert('here'); });and I get a popup when I click on the field.Can anyone help with this?Thanks,-Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Fix for the Interface Elements library
I have a fix for the Sortables feature. Anyone know how to post a fix, as I can't find info for reporting bugs on the site: http://interface.eyecon.ro/ -Ed ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
But, to my mind, it makes sense to do $('#myElement').parent().parent() because the parent of the input is a td and the parent of the td is the tr. Or is that wrong? No, you're right - On first glance I thought it was td id=myElement ... /td sorry about that. Not sure why .parent('tr') didn't work, though. Doesn't .parent() only look up one level? I thought you'd use .ancestors(). ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to make input readonly with jQuery in IE
$(span.readonly input).attr(disabled, disabled); Does this work? $(span.readonly input).attr(disabled, true); The XHTML attribute is disabled=disabled but the Javascript property is boolean. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
I'm consfused about the difference between parents() and ancestors(). The documentation on visualjquery.com isn't very clear as to the difference and the behavior seems to be the same. On 10/18/06, Dave Methvin [EMAIL PROTECTED] wrote: But, to my mind, it makes sense to do $('#myElement').parent().parent() because the parent of the input is a td and the parent of the td is the tr.Or is that wrong? No, you're right - On first glance I thought it was td id=myElement... /td sorry about that. Not sure why .parent('tr') didn't work, though.Doesn't .parent() only look up one level? I thought you'd use .ancestors(). ___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
Doesn't .parent() only look up one level? I thought you'd use .ancestors(). Oh yeah... man, I'm totally out of it today. Derrek - you should be using .parents(tr) or .ancestors(tr) (they're synonymous). --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to make input readonly with jQuery in IE
It isn't as pretty but you could just loop through them and set the property manually. $(span.readonly input).each(function() { this.disabled = true; }); I believe a fix for this is in the works, so that attr would work as you expected. -- Brandon Aaron On 10/18/06, Dave Methvin [EMAIL PROTECTED] wrote: $(span.readonly input).attr(disabled, disabled); Does this work? $(span.readonly input).attr(disabled, true); The XHTML attribute is disabled=disabled but the Javascript property is boolean. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
Yeah, but if I have a table embedded within a table (ugh, I know) then I find both the trs. I tried parents('tr').get(0), but that's not right either.Suggestions? On 10/18/06, John Resig [EMAIL PROTECTED] wrote: Doesn't .parent() only look up one level? I thought you'd use .ancestors().Oh yeah... man, I'm totally out of it today. Derrek - you should beusing .parents(tr) or .ancestors(tr) (they're synonymous). --John___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Fix for the Interface Elements library
Stefan Petre owns/maintains Interface, AFAIK. I know he checks in on the mailing list from time to time. What was broken, and what was your fix? Ed Hicks wrote: I have a fix for the Sortables feature. Anyone know how to post a fix, as I can't find info for reporting bugs on the site: http://interface.eyecon.ro/ -Ed ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Fix-for-the-Interface-Elements-library-tf2469890.html#a6886742 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
Yeah, but if I have a table embedded within a table (ugh, I know) then I find both the trs. I tried parents('tr').get(0), but that's not right either. The issue is that that the trs are returned in the order in which they're in the document. So the highest tr in the document is returned first. So the best way to do this is by doing: $(...).parents(tr:last) Which will give you the last tr found (but the one closest to your starting element). --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery history plugin - from making the back button work to a more elaborate Hijax solution
Hi jQuerians, people demanded, so I started to extract the history functionality from the tabs plugin to make a standalone plugin out of it. Worked out so far: http://stilbuero.de/jquery/history/ http://stilbuero.de/jquery/tabs/ It's still alpha, support for Firefox, Safari and Opera is there, IE not yet but will be added. Also todo is to automatically show the appropriate part, if the hash in the url refers to some point in the history but I can borrow that from the tabs plugin as well. At the moment it works by hooking into links and adding an event handler, like (prototypical code, setHash is required by Safari): $('a').click(function(e) { $.history.setHash('#' + this.href.split('#')[1], e); }); That's ok for me, I think its important to be able to control which links should be observed anyway. So the snippet above might become $('a.hijax').history(); with jQuery.fn.history = function() { return this.each(function() { $(this).click(function(e) { jQuery.history.setHash('#' + this.href.split('#')[1]); }); }); }; Or maybe it is reasonable to use a custom event? I'd like that: $('a.hijax').bind('history', function() {...}).click(function() { $(this).trigger('history'); }); Does that work? But: You all know, I'm all for unobtrusive JS and the concept of progressive enhancement. I don't like having a link in my HTML like a href=#chapter-1 which actually points nowhere with JS disabled. Why not implement a better solution for being able to implement Hijax the easy way (like what the form module is already offering)? So the links stay as they are and point to an existing ressource: a href=chapter-1.php Then I intercept all these links, change the href value to hashes and load on click the content from the URL of the initial href value via XHR. Links that already have a hash in their URL won't load via XHR but add to history (that is needed to stay compatible with tabs). That would 1. result in history support (in most browsers) and 2. in a nice gracefully degrading application with JS disabled or for browsers not supported by jQuery. Totally unobtrusive. That concept would of course involve the back-end as well. There it must be decided upon the X-Requested-With request header what to send back (whole page or only the part of the page that needs to be updated. What do you guys think? Feedback and ideas welcome... -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to safely get the clickTarget of an event?
If you mean the element, use 'this' inside the function to refer to the clicked element. If you mean the mouse position, I believe there are some functions available in the dimensions plugin.Blair On 10/19/06, Kurt Mackey [EMAIL PROTECTED] wrote: Is there a "jQuery" way of getting an event's click target? I tend to use those elements quite a bit, but getting them is a pain. J ___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
Hi John,Say I have:table id=tbl_atr id=tr_xtd/td/trtr id=tr_ytd/td/trtr id=tr_ztd/td/tr tr id=tr_atd id=td_a table id=tbl_b tr id=tr_b td id=td_b input id=myInput type=text / /td /tr /table/td/tr/tableIf I do $('#myInput').parents('tr:last').before('tr ... /tr') Then the the new row appears between tr id=tr_z and tr id=tr_a and not between table id=tbl_b and tr id=tr_b like I would expect. Did I screw up something?On 10/18/06, John Resig [EMAIL PROTECTED] wrote: Yeah, but if I have a table embedded within a table (ugh, I know) then I find both the trs.I tried parents('tr').get(0), but that's not right either.The issue is that that the trs are returned in the order in whichthey're in the document. So the highest tr in the document isreturned first. So the best way to do this is by doing: $(...).parents(tr:last)Which will give you the last tr found (but the one closest to yourstarting element).--John___jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
Try :first. I think parents() actually works differently from the other filters, in that the elements are in reverse order (parent is [0], grandparent is [1]).BlairOn 10/19/06, Derrek [EMAIL PROTECTED] wrote: Hi John,Say I have:table id=tbl_atr id=tr_xtd/td/trtr id=tr_ytd/td/trtr id=tr_ztd/td/tr tr id=tr_atd id=td_a table id=tbl_b tr id=tr_b td id=td_b input id=myInput type=text / /td /tr /table/td/tr/tableIf I do $('#myInput').parents('tr:last').before('tr ... /tr') Then the the new row appears between tr id=tr_z and tr id=tr_a and not between table id=tbl_b and tr id=tr_b like I would expect. Did I screw up something?On 10/18/06, John Resig [EMAIL PROTECTED] wrote: Yeah, but if I have a table embedded within a table (ugh, I know) then I find both the trs.I tried parents('tr').get(0), but that's not right either.The issue is that that the trs are returned in the order in whichthey're in the document. So the highest tr in the document isreturned first. So the best way to do this is by doing: $(...).parents(tr:last)Which will give you the last tr found (but the one closest to yourstarting element).--John___jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] parent()
Hey Blair,That did the trick. Thanks for the help.But I must (regretfully) say that the documentation on this point is lacking.It seems to me that parents() and ancestors() are the same except for the order of objects returned. parents() = parent[0], grandparent[1]ancestors() = grandparent[0], parent[1]Perhaps the someone could add this simple explanation to the documentation.I appreciate everyone's help,Derrek On 10/18/06, Blair McKenzie [EMAIL PROTECTED] wrote: Try :first. I think parents() actually works differently from the other filters, in that the elements are in reverse order (parent is [0], grandparent is [1]).Blair On 10/19/06, Derrek [EMAIL PROTECTED] wrote: Hi John,Say I have:table id=tbl_atr id=tr_xtd/td/trtr id=tr_ytd/td/trtr id=tr_ztd/td/tr tr id=tr_atd id=td_a table id=tbl_b tr id=tr_b td id=td_b input id=myInput type=text / /td /tr /table/td/tr/tableIf I do $('#myInput').parents('tr:last').before('tr ... /tr') Then the the new row appears between tr id=tr_z and tr id=tr_a and not between table id=tbl_b and tr id=tr_b like I would expect. Did I screw up something?On 10/18/06, John Resig [EMAIL PROTECTED] wrote: Yeah, but if I have a table embedded within a table (ugh, I know) then I find both the trs.I tried parents('tr').get(0), but that's not right either.The issue is that that the trs are returned in the order in whichthey're in the document. So the highest tr in the document isreturned first. So the best way to do this is by doing: $(...).parents(tr:last)Which will give you the last tr found (but the one closest to yourstarting element).--John___jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to safely get the clickTarget of an event?
Oh, that makes entirely too much sense, doesnt it? :p From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Blair McKenzie Sent: Wednesday, October 18, 2006 5:56 PM To: jQuery Discussion. Subject: Re: [jQuery] How to safely get the clickTarget of an event? If you mean the element, use 'this' inside the function to refer to the clicked element. If you mean the mouse position, I believe there are some functions available in the dimensions plugin. Blair On 10/19/06, Kurt Mackey [EMAIL PROTECTED] wrote: Is there a jQuery way of getting an event's click target? I tend to use those elements quite a bit, but getting them is a pain. J ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Please help (again, sorry)..NextUntil not working
Man, you are amazing at this stuff. Really appreciate all the effort you have taken, particularly putting up the test case. I am new to the mailing list and can't get past how prolific you are. You must live and breath this stuff. It is great to find someone so willing to help out!!! I have implemented your code and it works BEAUTIFULLY, straight out of the box. I will now go ahead and construct the dynamic navigation part. Will fire the URL to you when I've finished so you can have a look at where I was headed with this. Thanks again, Cheers, Greg Hat's off, Greg John Resig wrote: Ok, I did some more digging and you're right. I don't think I ever actually tested nextUntil (oops!) The full implementation can be found here: http://john.jquery.com/jquery/test/nextuntil.html This includes a working version of nextUntil: $.fn.nextUntil = function(expr) { var match = []; // We need to figure out which elements to push onto the array this.each(function(){ // Traverse through the sibling nodes for( var i = this.nextSibling; i; i = i.nextSibling ) { // Make sure that we're only dealing with elements if ( i.nodeType != 1 ) continue; // If we find a match then we need to stop if ( jQuery.filter( expr, [i] ).r.length ) break; // Otherwise, add it on to the stack match.push( i ); } }); return this.pushStack( match, arguments ); }; Additionally, I realized that .wrap() isn't going to do what you need it to. .wrap() wraps each matched element with the same structure. So if you matched 3 paragraphs, you'd have three surrounding divs too. Since you want it to wrap all of the matched elements with a single element, I made a new .wrapAll() plugin: $.fn.wrapAll = function() { // There needs to be at least one matched element for this to work if ( !this.length ) return this; // Find the element that we're wrapping with var b = jQuery.clean(arguments)[0]; // Make sure that its in the right position in the DOM this[0].parentNode.insertBefore( b, this[0] ); // Find its lowest point while ( b.firstChild ) b = b.firstChild; // And add all the elements there return this.appendTo(b); }; So - all of that should help you along now. Let me know if this works for you. --John On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Thanks for this Blair.a really interesting approach and one I wouldn't have thought of myself. At the moment, I am having problems with the NextUntil function, but once I have this solved, your suggestion may be a really neat implementation. Cheers, Greg Blair McKenzie-2 wrote: This is just a guess: function BuildNav() { $(#content h2).each(function(){ $(this).before(div class='note newdivmarker'/div).nextUntil(h2).appendTo(.newdivmarker); $( div.newdivmarker).removeClass(newdivmarker); }); } It relies on the assumption that appendTo moves the origonal element list, rather than clones them. Basically: 1. It adds your div before the heading, with a temporary marker so we can find it again 2. Selects all elements until the next heading 3. Moves them to the div 4. Removes the marker from the div Blair On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote: Hi John, thanks again for your help, unfortunately I have deployed your suggestions and am still unable to get it to work. You can view my testpage at: http://members.optusnet.com.au/greg.bird/mm/collapse.html My .js now reads: $(document).ready(function(){ BuildNav(); }); //DEFINE NextUntil FUNCTION $.fn.nextUntil = function(expr) { var match = []; this.each(function(){ var cur = this.nextSibling; while ( cur jQuery.filter( expr, [cur] ).r.length ) { match = jQuery.merge( match, [ cur ] ); cur = cur.nextSibling; } console.log(this,cur,match); }); return this.pushStack( match, arguments ); }; /*BUILD SIDE NAVIGATION*/ function BuildNav() { $(#content h2).each(function(){ $(this).nextUntil(h2).wrap(div class='note'/div); }); } I have logged the script and it appears that the match array is not being populated. I suspect that the Jquery.merge function is not triggering properly Does this function work with JQUERY 1.0.2? In note in the JQUERY doco that the function call is now $.merge. Trialled this without success. My aim here is to put a unique div around each section of the page and then dynamically create an expand/collapse navigation system. Have already achieved a similar result with a sliding navigation system. You can see this at: http://members.optusnet.com.au/greg.bird/mm/index.html This was easier as I didn't need to wrap
Re: [jQuery] Popup window reference problem
I have tried to directly use the window reference. i.e. var abc = ref.document.getElementById(abc1); abc.parentNode.removeChild(abc); The result is correct that the input box in popup windows being removed. Seems that jQuery cannot use popup window reference? On 10/17/06, Jacky [EMAIL PROTECTED] wrote: Dear all, I would like to make a simple popup which would copy current page content and do some conversion (e.g. text box to text). But I have met a problem of getting a wrong reference. Here is the code to demonstrate the problem: html head titleTest Popup/title script type=text/javascript src=jquery.js/script script type=text/javascript $(document).ready(function(){ $(#popup).click(specificPop); function specificPop(){ var ref = genericPopup(); $(ref.document).find(#popup_body #abc1).remove(); } function genericPopup(){ var ref = window.open('','','resizable=1,width=400,height=400'); var diva = $(#diva).clone(); ref.document.open(); ref.document.write('htmlheadtitlePopup/title/head'); ref.document.write('body id=popup_body'); ref.document.write($(diva).html()); ref.document.write('/body/html'); ref.document.close(); return ref; } }); /script /head body div id=diva input type=text id=abc1 value=111/ input type=text id=abc2 value=222/ /div a href=# id=popuppopup/a /body /html In this example, I would expect the text box #abc1 in the popup is removed. But it removes current window's one instead. For the removal code, I have tried the following approaches: $(ref.document).find(#abc1).remove(); $(ref.document).find(#popup_body #abc1).remove(); $(#popup_body #abc1,ref.document).remove(); $(ref.document).find(#popup_body #abc1,ref.document).remove(); but all failed. Any idea how can I can the correct reference?? P.S. using jQ ver 1.0.2 -- Best Regards, Jacky http://jacky.seezone.net -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Popup window reference problem
The only way I know of to use jQuery in another window/frame is to include jquery in that page's html, and then access it using window.$().BlairOn 10/19/06, Jacky [EMAIL PROTECTED] wrote:I have tried to directly use the window reference. i.e.var abc = ref.document.getElementById(abc1);abc.parentNode.removeChild(abc);The result is correct that the input box in popup windows being removed.Seems that jQuery cannot use popup window reference? On 10/17/06, Jacky [EMAIL PROTECTED] wrote: Dear all, I would like to make a simple popup which would copy current page content and do some conversion ( e.g. text box to text). But I have met a problem of getting a wrong reference. Here is the code to demonstrate the problem: html head titleTest Popup/title script type=text/_javascript_ src=""> script type=text/_javascript_ $(document).ready(function(){ $(#popup).click(specificPop); function specificPop(){ var ref = genericPopup(); $(ref.document).find(#popup_body #abc1).remove(); } function genericPopup(){ var ref = window.open('','','resizable=1,width=400,height=400'); var diva = $(#diva).clone(); ref.document.open(); ref.document.write('htmlheadtitlePopup/title/head'); ref.document.write ('body id=popup_body'); ref.document.write($(diva).html()); ref.document.write('/body/html'); ref.document.close(); return ref; } }); /script /head body div id=diva input type=text id=abc1 value=111/ input type=text id=abc2 value=222/ /div a href="" id=popuppopup/a /body /html In this example, I would expect the text box #abc1 in the popup is removed. But it removes current window's one instead. For the removal code, I have tried the following approaches: $(ref.document).find(#abc1).remove(); $(ref.document).find(#popup_body #abc1).remove(); $(#popup_body #abc1,ref.document).remove(); $(ref.document ).find(#popup_body #abc1,ref.document).remove(); but all failed. Any idea how can I can the correct reference?? P.S. using jQ ver 1.0.2 -- Best Regards, Jacky http://jacky.seezone.net--Best Regards,Jacky網絡暴民 http://jacky.seezone.net___ jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Tablesorter
I have a need to have the tablesorter do the following:1) Refresh when I need it to (I'm going to be doing DOM insertions, and will need to refresh the table after an insertion). The best thing I could think of thus far is $(.sortUp, .sortDown).click().click(). Obviously not the best idea. 2) Use custom sorters. I see that the table sorter SUPPORTS custom sorters and parsers, but I wasn't sure about the best way to do this.Christian? Anyone?-- Yehuda KatzWeb Developer | Wycats Designs (ph)718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] fundamentals: .index(obj) or better solution
John - Thank you, that worked! Part of what confused me was that index() is defined as having an Obj as the argument, but not what kind - my attempts at using an expression as an argument were failing, so I was running out of ideas. I wasn't following context properly. Have enjoyed working with jQuery lately, nice update. -- mike John Resig wrote: .index() doesn't do what you think it does. It works like this: // Find the position of the P that an ID of someP /within/ the list of p elements. $(p).index( $(#someP)[0] ) So, in your code it would be something like this: // div i want to find id = 3; // get the element i want to move var curr_obj = $([EMAIL PROTECTED]'id[]'[EMAIL PROTECTED]'+id+']).parent()[0]; // determine its current location within the set of list_items var old_pos = $(div.list_item).index(curr_obj); So two things to note: .get() returns an array of elements, not just a single element and .index() works over a list of elements, not the children of an element. I hope this makes sense, it is something of confusing method. I plan on polishing it up some, as it was a late addition to 1.0. --John On 10/17/06, Michael Crowl [EMAIL PROTECTED] wrote: .index() is driving me nuts, and I'm trying to figure out if there's an obvious solution to what I'm trying to do, or if I'm missing something in the API. Let's say I have the following: div name=list div class='list_item' input type='hidden' name='id[]' value='1' // interface /div div class='list_item' input type='hidden' name='id[]' value='2' // interface /div div class='list_item' input type='hidden' name='id[]' value='3' // interface /div div class='list_item' input type='hidden' name='id[]' value='4' // interface /div /div How do I determine the current element position of a particular list_item in that container, using jQuery? Using .index(), it seems like this should work: // div i want to find id = 3; // get the element i want to move var curr_obj = $([EMAIL PROTECTED]'id[]'[EMAIL PROTECTED]'+id+']).parent().get(); // determine its current location within the set of list_items var old_pos = $(#list).index(curr_obj); ...or a number of other combinations I've tried, and none of them can get anything but -1 from .index(). What am I doing wrong here? - Does .get() really return an element object? (It seems to.) - What kind of object is .index() looking for? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/