Hi, > ..."data-picker" is a real > attribute?? or you just add it for easy use with the $('*[data- > picker]') selector??
I made it up for use with the selector. Technically, custom (made-up) attributes are invalid in HTML4, but in practice browsers just ignore them (but do preserve them and give them to getAttribute/ readAttribute), although validators like the W3C's[1] flag them up (of course, that's their job). As of HTML5, custom attributes are explicitly allowed if they start with the prefix "data-". So you can have your own attributes if you like -- "data-foo", "data-bar", "data- my-nifty-thing", etc. [1] http://validator.w3.org HTH, -- T.J. :-) On Oct 15, 5:00 pm, ncubica <ncub...@gmail.com> wrote: > [off-topic] Hi TJ I just saw in your jsbin code the attribute <span > data-picker='colors=blue'>Blue</span> "data-picker" is a real > attribute?? or you just add it for easy use with the $('*[data- > picker]') selector?? > > thanks in advance > nahum > > On Oct 14, 10:35 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote: > > > > > Hi, > > > > Thanks also for the short version of your setSelect()... > > > Glad that helped! > > > > ...I tried in vain to do > > > that for a full day... another example of how the prototype documentation > > > really sucks! > > > Okay, granted it's a bit > > terse:http://api.prototypejs.org/dom/form/element/setvalue/ > > > ...but I wouldn't have said it "sucked." Regardless, I know from > > experience that they're very happy indeed to accept documentation > > patches to improve things... > > > -- T.J. ;-) > > > On Oct 14, 1:42 pm, Phil Petree <phil.pet...@gmail.com> wrote: > > > > Thanks TJ! > > > > I had fixed the Stack Overflow problem around 6a this morning... I would > > > share what the problem was but then I'd have to kill my self! LOL > > > > Thanks also for the short version of your setSelect(), I tried in vain to > > > do > > > that for a full day... another example of how the prototype documentation > > > really sucks! It should have been a 2 minute find/do. > > > > Not gonna worry about the click handler because there are only 8 onclicks > > > on > > > that page and I doubt a user will use more than 1 or 2 of them... if they > > > even realize those images work that way... just an easter egg is all it > > > is. > > > > On Thu, Oct 14, 2010 at 7:33 AM, T.J. Crowder > > > <t...@crowdersoftware.com>wrote: > > > > > Hi, > > > > > I'm not 100% sure what you're trying to do with all of those templates > > > > and that selector (the selector is invalid, looks like maybe you're > > > > trying to use a template in it, but it's all one big quoted string, > > > > so...). However, I _think_ you're trying to replicate the Prototype > > > > `Element#setValue` function. If I'm reading right, your `setSelect` > > > > could read like this: > > > > > function setSelect(selID, strValue) { > > > > $(selID).setValue(strValue); > > > > } > > > > > Live example:http://jsbin.com/aboyo > > > > > Perhaps off-topic, but I wouldn't have all of those onclicks if you > > > > can avoid it: > > > >http://jsbin.com/aboyo/2 > > > > > You can condense that a bit: > > > >http://jsbin.com/aboyo/3 > > > > > HTH, apologies if I've gotten the wrong end of the stick. > > > > -- > > > > T.J. Crowder > > > > Independent Software Engineer > > > > tj / crowder software / com > > > > www / crowder software / com > > > > > On Oct 14, 1:54 am, Phil Petree <phil.pet...@gmail.com> wrote: > > > > > Hey All! > > > > > > In my html doc I have a series of images... one for aol, yahoo, gmail, > > > > > facebook etc. and each image in written like this: > > > > > <img src='images/aol.png' border='0' onclick='setSelect("thSelect", > > > > > "aol");'/> > > > > > > In my javascript file I have setSelect defined like this: > > > > > function setSelect(strID, strValue) > > > > > { > > > > > var selectIDTemplate = new Template('#{matchID}'); > > > > > var selectTemplate = new Template('#{matchString}'); > > > > > var selectThis = {matchID: strID}; > > > > > var selectID = {matchString: strValue }; > > > > > $$('select#selectIDTemplate.evaluate(selectID) > > > > option').each(function(o){ > > > > > if(o.value == selectTemplate.evaluate(selectThis)){o.selected = > > > > > true;$break;} > > > > > }); > > > > > > } > > > > > > When I click on an image I get a "Stack Overflow on line 29" error. > > > > > This > > > > is > > > > > with prototype.js 1.6.1 > > > > > > Any ideas? Suggestions? > > > > > > Thanks! > > > > > > Pete > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups > > > > "Prototype & script.aculo.us" group. > > > > To post to this group, send email to > > > > prototype-scriptacul...@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculou > > > > s%2bunsubscr...@googlegroups.com> > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.