On Mar 7, 4:34 pm, Walter Lee Davis <wa...@wdstudio.com> wrote: > I have this little bit of fluff: > > Element.addMethods({ > addText: function(input, theText) { > if(typeof input.selectionStart != 'undefined'){ > var start = input.selectionStart; > var end = input.selectionEnd; > input.value = input.value.substr(0, start) + > theText + > input.value.substr(end); > input.selectionStart = start + theText.length; > input.selectionEnd = start + theText.length; > input.focus(); > } > } > }); > > But I want to add it only to Form.Element. I tried just tacking > `Form.` onto the front of this, but all I got was a syntax error. > Could someone clue me in how to add this method only to Form.Element? > (Obviously, it doesn't make much sense in a regular Element context.)
Form.Element.Methods.addText = function(){ /* ... */ }; Element.addMethods(); -- kangax --~--~---------~--~----~------------~-------~--~----~ 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-scriptaculous@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 -~----------~----~----~----~------~----~------~--~---