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 <
sash...@rambler.ru>