On Aug 28, 12:51 am, MrNase <[EMAIL PROTECTED]> wrote: > What I was trying to do here was to make a mootools example in jQuery. > > In mootools, all you need is: > > if(txt.val().contains('hello')) txt.trigger('burn', 'hello world!');
It would seem that val() returns a String object and that mootools adds the contains() method to String.prototype. Extending built-in types in this way is considered poor practice, partly because it makes code which uses those built-in types incompatible across toolkits. It can confuse people into thinking that those features are built in to the language, when they're really not. There are other down-sides to this type of extension, as well. > Therefore I was looking for a jQuery way to do it but contains() > doesn't work as expected. :( contains() is not a String method in jQuery, but is a member of the jQuery class and looks for an Element (or Elements) contained within another element.