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 records. And the only event that might check contents of textareas and inputs seems to be keyup... I've used your script to write this: JQuery: $('#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').removeAttr('disabled')); }); HTML: <form action="admin_content.php" method="post" id="post_form"> <input type="text" name="name" size="50" maxlength="100" id="post_name"> <textarea name="content" cols="70" rows="20" id="post_content"><?=$row["content"];?></textarea> <input type="Submit" value="Отправить" id="post_submit"> </form> Now textarea does work (text() did the trick) - that is, submit button is not activated when text is entered only there. But still, if you enter text only in the text field (#post_name), it IS activated. And i want let the user press it only when both fields are populated with at least one symbol of text. Please help) Andrea Varnier wrote: > > > 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() == '' && $('textarea', > 'form').val() == '') return false; > }); > }); > > it would be better if you gave id's to the elements you're going to > check ;) > > -- View this message in context: http://www.nabble.com/Disable-Submit-button-if-no-text-entered-tp17226575s27240p17232479.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.