[jQuery] cluetip feature request: disable; clear cache
Hello, I'm enjoying the jquery cluetip plugin -- it works very nicely and does what I want it to. But I have two requests. (1) $(foo).cluetip('disable'); This would disable the cluetip on a specific element or array of elements. $(foo).cluetip('clear_cache'); This would invalidate the cluetip cache for a specific element or array of elements, so that the next time the elements were hovered their cluetip contents would be reloaded via AJAX. In the current usage, could this already be achieved by simple setting the cluetip on the same elements a second time? Or does that do nothing? Thanks! Eric
[jQuery] Re: listnav plugin
Hi Jack, thanks for the reply, yes Im just adding/removing via jq Ive created a workaround that solves this one for me. Also I just posted another question, I would love to get this new one solved its driving me nuts! http://groups.google.com/group/jquery-en/browse_thread/thread/d10260b0ed3fa4ff/6b8b83bb5d21348a#6b8b83bb5d21348a On Nov 26, 7:58 pm, Jack Killpatrick <[EMAIL PROTECTED]> wrote: > Glad you like the plugin. Can you give me a little more about your use > case so I'm sure I know what you're asking for? IE, are you just > adding/removing LI's? > > - Jack > > idgcorp wrote: > > I have implemented this awesome plugin with great success and would > > like to know if its possible to refresh the plugin after appending/ > > removing data from the list. > > > Can I break the connection and then rebind the data?
[jQuery] listnav plugin mod
I would like to add numerical functionality to this plugin, but have been unsuccessful in getting it to work. In additition to the A, B, C...Z I would like to add an 0-9 category for names that start with a number. the way the plugin is written to auto create class names from the letters is straightforward but for the numbers I would need to show all items that start with 0-9 under the '0' class. I know what I need to do but havent been able to get it to work.
[jQuery] Re: Double right-click, anyone?
I'd also like to chime in that double-right click is probably not very good UI design. No one expects to have to double right click something and people will probably be even more pissed that the context menu is gone. People like that thing. Why do you seek to disable it? I'm curious. On Nov 30, 6:40 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > Have you ever tried capturing the right-click event in Opera? > > It has an additional level of security whereby each client must expressly > set the user preferences allowing a website to capture the right-click event > and stop the right-click bubble. > > The project I worked on last year had a right-click requirement which would > not play well with Opera. > > There is a user-friendly aspect of this too, as some users don't WANT their > browser-specific context menus to be taken away. > > This is why I recommended the CTRL-Click. > > As regards the Mac, I haven't tested that. Are you sure a Mac option-click > is interpreted as button 2? > > JK > > -Original Message- > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of ricardobeat > Sent: Sunday, November 30, 2008 6:31 PM > To: jQuery (English) > Subject: [jQuery] Re: Double right-click, anyone? > > returning false from the handler should cancel the context menu on > Opera and other browsers. And apparently on Macs the event for a Ctrl > +click carries the 'right-click' identifier (e.button = 2). > > cheers, > - ricardo > > On Nov 30, 4:07 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > > If I might make a suggestion. > > > Right-click context menus are inherently not cross-platform compatible, as > > Opera will not cancel the default right click popup. > > > Any any Mac users without a right mouse button are screwed. > > > I personally suggest using CTRL-Click. This works on a Mac testing for > the > > e.MetaKey property on the click event (CTRL-Click and Option-Click) > > > And instead of a double-right-click, you could just bind to the standard > > dblclick event, and test for e.MetaKey==true. > > > JK > > > -Original Message- > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > > Behalf Of ricardobeat > > Sent: Sunday, November 30, 2008 9:24 AM > > To: jQuery (English) > > Subject: [jQuery] Re: Double right-click, anyone? > > > I didn't test it in IE... no cookie. > > > Apparently the 'mousedown' event was at random not carrying the > > property that tells us what button was clicked, a triple click was > > needed. I switched to mouseup and it seems to work fine, I also had > > forgotten to clear the timeout and set the var to false when the > > double click happened. Check out the new version: > > >http://jsbin.com/iyegu/ > > > cheers, > > - ricardo > > > On Nov 30, 8:32 am, TheBlueSky <[EMAIL PROTECTED]> wrote: > > > I forgot to mention also that I disabled the context menu with the > > > code > > > $('html').bind("contextmenu", function(e) {return false;}); > > > > and if I didn't do that, the context menu will appear and every right- > > > click then will fire the double-click event in IE. I guess that's > > > because in IE the double-click event won't fire until the time out > > > duration finishes and in FF it's the opposite, i.e. the event won't > > > fire after the time out duration! > > > > On Nov 30, 2:10 pm, TheBlueSky <[EMAIL PROTECTED]> wrote: > > > > > Thanks for the code... but I couldn't manage to make it work at all in > > > > IE and in FF the only time it worked is if I replaced $('body') with $ > > > > ('html)! Any idea how to make it work with a specific element; e.g. > > > > and image with id="myImage", because when I tried $('#myImage') it > > > > didn't work as well. > > > > > By the way, for IE I replaced console.log() with alert(), but no > > > > success. > > > > > On Nov 29, 10:58 pm, ricardobeat <[EMAIL PROTECTED]> wrote: > > > > > > A quick implementation: > > > > > > $('body').unbind('mousedown').mousedown(function(e){ > > > > >var rightclick = (e.which) > > > > >? (e.which == 3) > > > > >: (e.button == 2); > > > > >var t = $(this); > > > > >if (rightclick) { > > > > >console.log('rightclick'); > > > > >if (t.data('rightclicked')) { > > > > > console.log('double click!'); > > > > >} else { > > > > >t.data('rightclicked',true); > > > > >setTimeout((function(t){ return function(){ t.data > > > > > ('rightclicked',false); } })(t), 300); > > > > >}; > > > > >}; > > > > > > }); > > > > > > - ricardo > > > > > > On Nov 29, 10:20 am, TheBlueSky <[EMAIL PROTECTED]> wrote: > > > > > > > Hi everyone, > > > > > > Does anyone has code, implementation, plug-in or whatever to > detect > > > > > > double right-click? I'm searching and trying for couple of days > now > > > > > > without any result. > > > > > > Appreciate any help.- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > > - Show quoted text -
[jQuery] Re: Image rollover using jQuery
plugin? How about the native .hover? $('img').hover(function() { $(this).attr('src',path + '' + $('this).attr('id') + '_over.gif'; }, function() { $(this).attr('src',path + '' + $('this).attr('id') + '_off.gif'; }); That will make every image on the page a rollover, changing the src of the image to the id + "_over.gif" or "_off.gif" of the image in whatever directory you have defined path to be. Instead of using the ID you could look at the src of the image and add '_over just in front of the .gif and take it out for the other hover. However you want to do it. Then change the selector to be whatever group of images you want to have rollovers. Maybe $('img.rollover') which would be all images with the class rollover. On Nov 30, 1:14 am, Ray M <[EMAIL PROTECTED]> wrote: > Hello, > > Are there any existing jQuery plugin which can provide similar image > rollover functions such as the one provided by Dreamweaver? > > Thanks. > > Ray
[jQuery] Re: [treeview] Brief flash of expanded tree
Thanks Dirceu, but i'm otherwise happy to stick with treeview. I'm not sure if it's the best solution, but a friend of mine helped me overcome the issue i was experiencing. We added a line of CSS to hide treeview on load, and then set it to display in the demo.js file once everything was loaded ie $("#browser").treeview({ animated: "fast", persist: "cookie", collapsed: true }).css('display','block'); Any feedback on this would still be appreciated. Dirceu Barquette wrote: > Try my plugin. > http://sourceforge.net/projects/jqtreevial/ > > 2008/11/29 Andrew <[EMAIL PROTECTED]> > > > > > Hi > > > > I've got the treeview plugin set to be collapsed on load. This works > > generally, but every now and then, the page loads and the tree appears > > fully expanded, before shrinking back to it's collapsed (or whatever > > cookie state). > > > > The page i'm working at is www.australian-postcodes.com. > > Try clicking Animated > Leader > Ultramagnus ... and then Unofficial > > > Fansproject > City Commander, and if it doesn't do it, go back and > > forth between the 2 pages a few times. > > > > I managed to grab a screenshot of the expanded list before it > > collapses - http://www.australian-postcodes.com/treeview.png ... you > > can see the styles are only partially applied as well? > > > > Please help! Otherwise, i've found this plugin to be just what i > > needed :) > > > > Thanks, Andrew > >
[jQuery] Re: Image rollover using jQuery
Maybe this: http://code.google.com/p/jquery-swapimage/ On Nov 30, 5:14 pm, Ray M <[EMAIL PROTECTED]> wrote: > Hello, > > Are there any existing jQuery plugin which can provide similar image > rollover functions such as the one provided by Dreamweaver? > > Thanks. > > Ray
[jQuery] Re: Image rollover using jQuery
On Nov 30, 2008, at 4:14 AM, Ray M wrote: Hello, Are there any existing jQuery plugin which can provide similar image rollover functions such as the one provided by Dreamweaver? Thanks. Ray Hi Ray, If you're referring to the dreaded MM_swapImage(), I think most people these days just use image sprites and change the background position on hover using pure CSS. If you want some sort of animated hover effect, one option is described here: http://www.snook.ca/archives/javascript/jquery-bg-image-animations/ --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Links within links, and overriding clicks.
On Nov 30, 5:33 pm, René <[EMAIL PROTECTED]> wrote: > Just wondering... > > When you have a link within a link: No idea why you would do this... > This is some long row of test and here is a > and some more > text > > ...how do you override the parent click event? $(document).ready(fuction(){ $("a#main").click(function(){ return false;}); });
[jQuery] [tooltip] Cannot get tooltip to bind
I am using the jQuery Tooltip Plugin from http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/. Great plugin. I am AJAX loading some content into my pages and am attempting to use Live Query to bind the tooltips to some of those links. Is not working: $('.thumb-ttr').livequery(function(){ $('.thumb-ttr').tooltip({track:true, delay:0, showURL:false, showBody:' || ', opacity:0.85}); }); I also made an unsuccesful try using a focus event: $('.thumb-ttr').livequery('focus', function(event){ $('.thumb-ttr').tooltip({track:true, delay:0, showURL:false, showBody:' || ', opacity:0.85}); }); Any help is appreciated! Thank you.
[jQuery] Re: Double right-click, anyone?
Have you ever tried capturing the right-click event in Opera? It has an additional level of security whereby each client must expressly set the user preferences allowing a website to capture the right-click event and stop the right-click bubble. The project I worked on last year had a right-click requirement which would not play well with Opera. There is a user-friendly aspect of this too, as some users don't WANT their browser-specific context menus to be taken away. This is why I recommended the CTRL-Click. As regards the Mac, I haven't tested that. Are you sure a Mac option-click is interpreted as button 2? JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ricardobeat Sent: Sunday, November 30, 2008 6:31 PM To: jQuery (English) Subject: [jQuery] Re: Double right-click, anyone? returning false from the handler should cancel the context menu on Opera and other browsers. And apparently on Macs the event for a Ctrl +click carries the 'right-click' identifier (e.button = 2). cheers, - ricardo On Nov 30, 4:07 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > If I might make a suggestion. > > Right-click context menus are inherently not cross-platform compatible, as > Opera will not cancel the default right click popup. > > Any any Mac users without a right mouse button are screwed. > > I personally suggest using CTRL-Click. This works on a Mac testing for the > e.MetaKey property on the click event (CTRL-Click and Option-Click) > > And instead of a double-right-click, you could just bind to the standard > dblclick event, and test for e.MetaKey==true. > > JK > > -Original Message- > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of ricardobeat > Sent: Sunday, November 30, 2008 9:24 AM > To: jQuery (English) > Subject: [jQuery] Re: Double right-click, anyone? > > I didn't test it in IE... no cookie. > > Apparently the 'mousedown' event was at random not carrying the > property that tells us what button was clicked, a triple click was > needed. I switched to mouseup and it seems to work fine, I also had > forgotten to clear the timeout and set the var to false when the > double click happened. Check out the new version: > > http://jsbin.com/iyegu/ > > cheers, > - ricardo > > On Nov 30, 8:32 am, TheBlueSky <[EMAIL PROTECTED]> wrote: > > I forgot to mention also that I disabled the context menu with the > > code > > $('html').bind("contextmenu", function(e) {return false;}); > > > and if I didn't do that, the context menu will appear and every right- > > click then will fire the double-click event in IE. I guess that's > > because in IE the double-click event won't fire until the time out > > duration finishes and in FF it's the opposite, i.e. the event won't > > fire after the time out duration! > > > On Nov 30, 2:10 pm, TheBlueSky <[EMAIL PROTECTED]> wrote: > > > > Thanks for the code... but I couldn't manage to make it work at all in > > > IE and in FF the only time it worked is if I replaced $('body') with $ > > > ('html)! Any idea how to make it work with a specific element; e.g. > > > and image with id="myImage", because when I tried $('#myImage') it > > > didn't work as well. > > > > By the way, for IE I replaced console.log() with alert(), but no > > > success. > > > > On Nov 29, 10:58 pm, ricardobeat <[EMAIL PROTECTED]> wrote: > > > > > A quick implementation: > > > > > $('body').unbind('mousedown').mousedown(function(e){ > > > > var rightclick = (e.which) > > > > ? (e.which == 3) > > > > : (e.button == 2); > > > > var t = $(this); > > > > if (rightclick) { > > > > console.log('rightclick'); > > > > if (t.data('rightclicked')) { > > > > console.log('double click!'); > > > > } else { > > > > t.data('rightclicked',true); > > > > setTimeout((function(t){ return function(){ t.data > > > > ('rightclicked',false); } })(t), 300); > > > > }; > > > > }; > > > > > }); > > > > > - ricardo > > > > > On Nov 29, 10:20 am, TheBlueSky <[EMAIL PROTECTED]> wrote: > > > > > > Hi everyone, > > > > > Does anyone has code, implementation, plug-in or whatever to detect > > > > > double right-click? I'm searching and trying for couple of days now > > > > > without any result. > > > > > Appreciate any help.- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text -
[jQuery] Re: Double right-click, anyone?
returning false from the handler should cancel the context menu on Opera and other browsers. And apparently on Macs the event for a Ctrl +click carries the 'right-click' identifier (e.button = 2). cheers, - ricardo On Nov 30, 4:07 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > If I might make a suggestion. > > Right-click context menus are inherently not cross-platform compatible, as > Opera will not cancel the default right click popup. > > Any any Mac users without a right mouse button are screwed. > > I personally suggest using CTRL-Click. This works on a Mac testing for the > e.MetaKey property on the click event (CTRL-Click and Option-Click) > > And instead of a double-right-click, you could just bind to the standard > dblclick event, and test for e.MetaKey==true. > > JK > > -Original Message- > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of ricardobeat > Sent: Sunday, November 30, 2008 9:24 AM > To: jQuery (English) > Subject: [jQuery] Re: Double right-click, anyone? > > I didn't test it in IE... no cookie. > > Apparently the 'mousedown' event was at random not carrying the > property that tells us what button was clicked, a triple click was > needed. I switched to mouseup and it seems to work fine, I also had > forgotten to clear the timeout and set the var to false when the > double click happened. Check out the new version: > > http://jsbin.com/iyegu/ > > cheers, > - ricardo > > On Nov 30, 8:32 am, TheBlueSky <[EMAIL PROTECTED]> wrote: > > I forgot to mention also that I disabled the context menu with the > > code > > $('html').bind("contextmenu", function(e) {return false;}); > > > and if I didn't do that, the context menu will appear and every right- > > click then will fire the double-click event in IE. I guess that's > > because in IE the double-click event won't fire until the time out > > duration finishes and in FF it's the opposite, i.e. the event won't > > fire after the time out duration! > > > On Nov 30, 2:10 pm, TheBlueSky <[EMAIL PROTECTED]> wrote: > > > > Thanks for the code... but I couldn't manage to make it work at all in > > > IE and in FF the only time it worked is if I replaced $('body') with $ > > > ('html)! Any idea how to make it work with a specific element; e.g. > > > and image with id="myImage", because when I tried $('#myImage') it > > > didn't work as well. > > > > By the way, for IE I replaced console.log() with alert(), but no > > > success. > > > > On Nov 29, 10:58 pm, ricardobeat <[EMAIL PROTECTED]> wrote: > > > > > A quick implementation: > > > > > $('body').unbind('mousedown').mousedown(function(e){ > > > > var rightclick = (e.which) > > > > ? (e.which == 3) > > > > : (e.button == 2); > > > > var t = $(this); > > > > if (rightclick) { > > > > console.log('rightclick'); > > > > if (t.data('rightclicked')) { > > > > console.log('double click!'); > > > > } else { > > > > t.data('rightclicked',true); > > > > setTimeout((function(t){ return function(){ t.data > > > > ('rightclicked',false); } })(t), 300); > > > > }; > > > > }; > > > > > }); > > > > > - ricardo > > > > > On Nov 29, 10:20 am, TheBlueSky <[EMAIL PROTECTED]> wrote: > > > > > > Hi everyone, > > > > > Does anyone has code, implementation, plug-in or whatever to detect > > > > > double right-click? I'm searching and trying for couple of days now > > > > > without any result. > > > > > Appreciate any help.- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text -
[jQuery] Re: [Beginner alert] How do I output the selected part of the DOM in a web page in a JS alert()?
Hi there, Where in the example is the class 'third' you mentioned? and what is this supposed to do? javascript:getActiveText(); Alert me! The best I can do is point you to https://developer.mozilla.org/en/DOM/Selection. Read on about the selection object and range object, and you'll see that this is not as simple as it looks! You're still very far from accomplishing what you want. May I ask what is the purpose of it? cheers, - ricardo On Nov 30, 2:06 pm, stephane_r <[EMAIL PROTECTED]> wrote: > Hello, > > Consider the code snippet at the end of the post. > > It alert()s me by returning the selected text. > > The problem is that window.getSelection() only returns plain text. No > indication of the html tags, of the classes, nor any kind of DOM. > > I think that jQuery has something more complete than window.getSelection(), > but I was not able to find it reading the docs and searching Google. I'm a > beginner with jQuery, as you've probably figured right now. > > The ultimate goal would be to filter the selection so that only text > enclosed in given classes (say loremipsum and third in my example) are > returned. I'd take it as a bonus, but I can figure this part by myself > server-side. > > Cheers, > Stéphane > > > > > function getActiveText(e) { > var text = window.getSelection(); > alert(text);} > > > > > Lorem ipsum dolor sit amet, magna massa aliquet in > libero, a suscipit suspendisse ac penatibus, lectus donec consequat, sed > justo > javascript:getActiveText(); Alert me! > > > > -- > View this message in > context:http://www.nabble.com/-Beginner-alert--How-do-I-output-the-selected-p... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: accordion - trigger *and* link possible?
Thanks Jörn; > an accordion header is just that, not two things at > once. Okay. I'll accept that. I can see how things would get messy. > In your case you're probably better of with a serverside > component. Never considered such a thing. Interesting. Do you have any serverside components you can recommend? I do like having all the links "exposed' in a the markup and letting jQuery provide the behavior though. And I REALLY like how easy the jQuery component makes a menu using the "navigation" option. > See alsohttp://docs.jquery.com/UI/Accordion#What_this_isn.27t Funny. I read that several times and figured it didn't apply to my project because I didn't want more than one panel open at a time! :( Thanks again. Steve
[jQuery] Links within links, and overriding clicks.
Just wondering... When you have a link within a link: This is some long row of test and here is a and some more text ...how do you override the parent click event?
[jQuery] Re: jQuery loop help
First off, I want to thank everyone for such quick replies. > That will work, but it's a fairly brittle way to do things. If you add > another link earlier in your page, it will change the loop indexes and > you'll have to revise your code to match. I understand and agree with you. I don't think it's a bulletpoof technique. I'm honestly just trying this as a way to explore and understand the language. > Instead, I would suggest giving each of those A tags its own ID. That way > you don't have to change your code if you rearrange the tags or add another > one in the middle. For example: > > > link 1 > link 2 > link 3 > > > Now you can simply give each one its own click handler: > > $('#one').click( function() { > // handle click on link 1 > return false; // suppress default action > }); > > $('#two').click( function() { > // handle click on link 2 > return false; // suppress default action > }); > > etc. > > Or you can still use a switch statement if you want: > > $('a').click( function() { > switch( this.id ) { > case 'one': > // handle click on link 1 > break; > } > }); I honestly thought of a similar idea using the rel attribute, but this is not really what I want. I'd like to try doing this without having to "dirty-up" the markup (no attributes: id, rel, etc. ). > If there are a large number of A tags in your page, you may want to consider > event delegation instead. It's pretty easy to do. How many A tags will there > be? As of now, there are only four links. Nevertheless, I'm trying to code this in a way so that the number of links doesn't matter...
[jQuery] Re: jQuery loop help
> > If you just want the loop index, it's passed to the .each() callback as the > > first parameter: > > > $('a').each( function( i ){ > > // 'i' is the loop index > > $(this).click(function(){ > > // You can use 'i' directly in this code > > }); > > }); > > Now, imagine you have the following html items > > > link 1 > link 2 > link 3 > > > Basically, I want to do is have jQuery make each link call myFunction > when clicked and pass its index so the the correct switch statement is > fired... I think Michael Geary already posted exactly what you want, after a slight modification :) $('#myLinks a').each( function( i ){ // 'i' is the loop index $(this).click(function(){ // You can use 'i' directly in this code alert("You clicked on link #" + i); }); });
[jQuery] Re: AJAX doesn't work on remote server
I have the same problem. Have you found any solution? On Oct 10, 3:54 pm, altern <[EMAIL PROTECTED]> wrote: > I need some help because of great confusion that make me crazy. I have > ajax query function which works fine on firefox, ie (both 6 & 7) > locally and with firefox on remote server. But it fails on ie (both 6 > & 7) if I use it on remote server. I have PHP codehttp://www.pastie.org/289451 > that generates js codehttp://www.pastie.org/289453. What am I doing > wrong? > > Error function for some reason is called earlier then timeout passes. > I always get error function called when I try to execute > get_response() function. Just on IE and just when I work with remote > server. Thanks in advance!
[jQuery] Re: jQuery loop help
> > From: Michael Geary > > But is the loop index that useful here? I'm trying to > > picture what you might do with it. There may be a > > better way to do this - if you could say more about > > your application, someone may have a suggestion. > From: SLR > To give you a brief rundown. Imagine having a generic > function with a nested switch statment. > > function myFunction(param) > { >switch(param) >{ > case 1: // some code > break; > > case 2: // some code > break; > > case 3: // some code > break; >} > } > > Now, imagine you have the following html items > > >link 1 >link 2 >link 3 > > > Basically, I want to do is have jQuery make each link call > myFunction when clicked and pass its index so the the correct > switch statement is fired... That will work, but it's a fairly brittle way to do things. If you add another link earlier in your page, it will change the loop indexes and you'll have to revise your code to match. Instead, I would suggest giving each of those A tags its own ID. That way you don't have to change your code if you rearrange the tags or add another one in the middle. For example: link 1 link 2 link 3 Now you can simply give each one its own click handler: $('#one').click( function() { // handle click on link 1 return false; // suppress default action }); $('#two').click( function() { // handle click on link 2 return false; // suppress default action }); etc. Or you can still use a switch statement if you want: $('a').click( function() { switch( this.id ) { case 'one': // handle click on link 1 break; } }); If there are a large number of A tags in your page, you may want to consider event delegation instead. It's pretty easy to do. How many A tags will there be? -Mike
[jQuery] Re: jQuery loop help
One way you could do this is have give the links in question a specific ID, class or attribute. For example: link 1 link 2 link 3 $('#myLinks a').click(doSomething); function doSomething(e){ switch ($(this).attr('id')) { case "link1": // Some code. break; case "link2": // Some code. Break; case "link3": // Some code. break; } } JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of SLR Sent: Sunday, November 30, 2008 3:12 PM To: jQuery (English) Subject: [jQuery] Re: jQuery loop help > No question is too "noobie". Welcome aboard! :-) I appreciate the warm welcome = ) > That code won't work at all. > I would suggest reading the doc page on .each(): Definitely on my to-do list... > If you just want the loop index, it's passed to the .each() callback as the > first parameter: > > $('a').each( function( i ){ > // 'i' is the loop index > $(this).click(function(){ > // You can use 'i' directly in this code > }); > }); Thanks for the info here, I'll definitely play around with it and see what I can do. > But is the loop index that useful here? I'm trying to picture what you might > do with it. There may be a better way to do this - if you could say more > about your application, someone may have a suggestion. To give you a brief rundown. Imagine having a generic function with a nested switch statment. function myFunction(param) { switch(param) { case 1: // some code break; case 2: // some code break; case 3: // some code break; } } Now, imagine you have the following html items link 1 link 2 link 3 Basically, I want to do is have jQuery make each link call myFunction when clicked and pass its index so the the correct switch statement is fired...
[jQuery] Javascript, or only Javascript-inna-browser?
Is jQuery supposed to be specifically targeted at Web client-side (i.e., browser) usage? Or to make Javascript easier in general? Most of its functionality seems aimed at the former, but there are a number of aspects that I can see would be useful in now-client environments. I ask because currently jquery.js is dependent on 'window' being globally defined, which of course isn't the case for, say, a Rhino environment. Thanks again..
[jQuery] Re: [jEditable] select editinplace has empty pulldown
Bingo. Thanks again!
[jQuery] Re: jQuery loop help
> No question is too "noobie". Welcome aboard! :-) I appreciate the warm welcome = ) > That code won't work at all. > I would suggest reading the doc page on .each(): Definitely on my to-do list... > If you just want the loop index, it's passed to the .each() callback as the > first parameter: > > $('a').each( function( i ){ > // 'i' is the loop index > $(this).click(function(){ > // You can use 'i' directly in this code > }); > }); Thanks for the info here, I'll definitely play around with it and see what I can do. > But is the loop index that useful here? I'm trying to picture what you might > do with it. There may be a better way to do this - if you could say more > about your application, someone may have a suggestion. To give you a brief rundown. Imagine having a generic function with a nested switch statment. function myFunction(param) { switch(param) { case 1: // some code break; case 2: // some code break; case 3: // some code break; } } Now, imagine you have the following html items link 1 link 2 link 3 Basically, I want to do is have jQuery make each link call myFunction when clicked and pass its index so the the correct switch statement is fired...
[jQuery] Re: accordion - trigger *and* link possible?
Thats by design - an accordion header is just that, not two things at once. In your case you're probably better of with a serverside component. See also http://docs.jquery.com/UI/Accordion#What_this_isn.27t Jörn On Sun, Nov 30, 2008 at 11:10 PM, snlsn <[EMAIL PROTECTED]> wrote: > > I'm new to the jQuery UI accordion. I'm hoping to use it for a menu. > I'm loving the "navigation" option. However, one of my team members > feels strongly that, in order to avoid confusion, every user's click > should load a page. It appears that the accordion widget prevents > navigating to the href attribute of an element that is also a panel > heading. The sub-items open and close fine but the href is ignored. > I'm using a nested format to construct the menu. Am I missing > something? > > Thanks. > Steve
[jQuery] Re: [jEditable] select editinplace has empty pulldown
On Nov 30, 2008, at 11:07 PM, Rodent of Unusual Size wrote: I'm trying to set up some form elements for in-place editing using jEditable, but in every case the pulldown is always empty. Firebug doesn't reports any errors or problems. As far as I can tell, I'm doing this according to the documentation at the jEditable site. Is this me again? Jeditable excpects data to be json string. You are now passing native hash. The following should work: data : "{'1':'True','0':'False'}", -- Mika Tuupola http://www.appelsiini.net/
[jQuery] Re: [validate] Allowing letters only in a text input?
Deron, you would need to add the rule: lettersonly: true // assuming you want name to be validated with lettersonly to any set of rules that you want this method to apply to I have an example form set up here: http://ecommerce.i-cre8.com/admin/add-new-test.php that shows how you can set up custom rules Regards, Dave Buchholz I-CRE8 Internet Solutions http://www.i-cre8.co.uk Skype: I-CRE8 On Nov 30, 7:54 pm, deronsizemore <[EMAIL PROTECTED]> wrote: > Hi! Thanks for the quick reply. So, with this code added, will it make all > fields letters only or is there a way for me to specify what field(s) I want > to allow letters only? > > Thanks, > Deron > > > > I-CRE8 wrote: > > > On Nov 29, 11:06 pm, deronsizemore <[EMAIL PROTECTED]> wrote: > > >> The code is as follows: > > >> jQuery.validator.addMethod("lettersonly", function(value, element) { > >> return this.optional(element) || /^[a-z]+$/i.test(value); > > >> }, "Letters only please"); > > >> My problem is that I'm not sure where to place the above code so that I > >> can > >> require only letters in one of my fields? > > > Hi, > > > you would please your code something like this: > > > > > > jQuery.validator.addMethod("lettersonly", function(value, element) { > > return this.optional(element) || /^[a-z]+$/i.test(value); > > > }, "Letters only please"); > > > $().ready(function() { > > $("#submit").validate({ > > errorPlacement: function(error, element) { > > error.insertBefore(element); > > }, > > rules: { > > name: { > > required: true, > > lettersonly: true // assuming you want name > > to be validated with lettersonly > > > }, > > email: { > > required: true, > > email: true > > } > > }, > > messages: { > > name: "Please enter your name", > > email: { > > required: "Please enter your email", > > email: "Please enter a valid email > > address" > > } > > } > > }); > > > }); > > > > > Regards, > > > Dave Buchholz > > I-CRE8 Internet Solutions > >http://www.i-cre8.co.uk > > Skype: I-CRE8 > > -- > View this message in > context:http://www.nabble.com/-validate--Allowing-letters-only-in-a-text-inpu... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] accordion - trigger *and* link possible?
I'm new to the jQuery UI accordion. I'm hoping to use it for a menu. I'm loving the "navigation" option. However, one of my team members feels strongly that, in order to avoid confusion, every user's click should load a page. It appears that the accordion widget prevents navigating to the href attribute of an element that is also a panel heading. The sub-items open and close fine but the href is ignored. I'm using a nested format to construct the menu. Am I missing something? Thanks. Steve
[jQuery] Re: .ajax and ie7?
That's good, I'm glad you got it working. I'd still suggest moving to the generated JavaScript approach I outlined. Hopefully it will look less complicated now that you've gotten some sleep. :-) Was it the document.write call that seemed complicated? > document.write( > '', > '<\/script>' > ); Let's break that down a bit. All it's doing is generating a