[jQuery] Disable Submit button if no text entered

[jQuery] Disable Submit button if no text entered


Hello!
I have on the page one input field, a textarea and a submit button.
I've managed to write a little script (it cost me many hours:) which
currently disables the submit button if no text entered in the input field
OR textarea. However, I need both of them populated for the button to be
activated. How it could be done?
Here's the HTML code:
<form action="admin_content.php" method="post">
    <input type="text" name="name" size="50" maxlength="100">
    <textarea name="content" cols="70"
rows="20"><?=$row["content"];?></textarea>
    <input type="Submit" value="Submit">
</form>
Here's JQuery code:
$(document).ready(function() {
$("input[type='submit']").attr("disabled","disabled");
$(":input").keyup( function () {
if (!this.value == "") {
$("input[type='submit']").removeAttr("disabled");
}
else $("input[type='submit']").attr("disabled","disabled");
});
});
I would be thankful for any suggestion.
--
View this message in context: http://www.nabble.com/Disable-Submit-button-if-no-text-entered-tp17226575s27240p17226575.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.