[jQuery] Re: Disable Submit button if no text entered

2008-05-16 Thread sashabe
Yes, but it seems that the script checks the input length only one time at page load, and then button's state doesn't change if you continue to type or delete input's content. Michael E. Carluen-2 wrote: > > > Another suggestion will be to get the length of the field: > > var t = ($('#post_n

[jQuery] Re: Disable Submit button if no text entered

2008-05-14 Thread Michael E. Carluen
Another suggestion will be to get the length of the field: var t = ($('#post_name').val()).length; if (t > 0) { $("[EMAIL PROTECTED]").removeAttr('disabled'); } This way, you can even have the option of enforcing a minimum char length of the field/s. Michael > It seems

[jQuery] Re: Disable Submit button if no text entered

2008-05-14 Thread sashabe
Thanks!!! That's exactly what I wanted =) Don't know if it's a bug, but with val entering some text in textarea with blank name field activated the button. With text() it stopped to do so. And, as I've read from some of the messages, text() could be more effective when dealing with textarea conte

[jQuery] Re: Disable Submit button if no text entered

2008-05-14 Thread Dave Methvin
> $('#post_submit').attr('disabled', 'disabled'); > $('#post_form').keyup( function () { > if ($('#post_name', '#post_form').val() == '' && $('#post_content', > '#post_form').text() == '') $('#post_submit').attr('disabled', 'disabled'); > else ($('#post_submit', '#post_form').remov

[jQuery] Re: Disable Submit button if no text entered

2008-05-14 Thread sashabe
Thank you! :) It seems that submit method is not what this case requires because it does the job when user interacts with submit button (correct me please if I'm wrong). The button should be disabled if both field and textarea (now they are id's ;) do not contain any text, to prevent blank recor

[jQuery] Re: Disable Submit button if no text entered

2008-05-14 Thread andrea varnier
On 14 Mag, 11:01, sashabe <[EMAIL PROTECTED]> wrote: > Hello! hi :) you'd better use the submit() method and 'return false'. Then a quick solution to your problem could look like this: $(document).ready(function(){ $('form').submit(function(){ if ($('input:first', 'form').val() == ''