[jQuery] Re: textareas and contains()

2007-08-27 Thread Stephan Beal
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 moot

[jQuery] Re: textareas and contains()

2007-08-27 Thread Stephan Beal
On Aug 27, 3:20 pm, MrNase <[EMAIL PROTECTED]> wrote: > if ($('#myTextarea').val().indexOf('hello') != -1) { > log.empty().html('test'); > } > else if > ($('#myTextarea

[jQuery] Re: textareas and contains()

2007-08-27 Thread MrNase
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!'); Therefore I was looking for a jQuery way to do it but contains() doesn't work as expected. :( On Aug 27, 3:39 pm, Klaus

[jQuery] Re: textareas and contains()

2007-08-27 Thread Klaus Hartl
MrNase wrote: $('#myTextarea').attr('val').indexOf('hello') != -1 --Klaus $('#myTextarea').val().indexOf('hello') != -1 works. Thanks! :) Now, when I extend my code it doesn't work anymore. if ($('#myTextarea').val().indexOf('hello') != -1) {

[jQuery] Re: textareas and contains()

2007-08-27 Thread MrNase
> $('#myTextarea').attr('val').indexOf('hello') != -1 > > --Klaus $('#myTextarea').val().indexOf('hello') != -1 works. Thanks! :) Now, when I extend my code it doesn't work anymore. if ($('#myTextarea').val().indexOf('hello') != -1) {

[jQuery] Re: textareas and contains()

2007-08-24 Thread Herr M.
> I already tried several versions including this one: > > $('#myTextarea').bind("keyup", function(){ > if ( $("#myTextarea[value:contains('hello')]")) > log.empty().html('test'); > > }); I think skipping the attribute part of the jquery string should work: if ( $("#myTextarea:con

[jQuery] Re: textareas and contains()

2007-08-23 Thread Klaus Hartl
MrNase wrote: I am currently at war with the contains function. :-( Here's my snippet which doesn't work. $('#myTextarea').bind("keyup", function(){ if ($('#myTextarea').attr('val').contains('hello')) {