Reputation: 2590
I have Ajax page where I get search response inside textarea.
Here is the code
<form onSubmit="checkDomain();return false;" id="ajaxDomainForm" action="">
<input name="domain" type="text" id="domain" onKeyUp="checkForChange();" maxlength="255">
<textarea name="domainsAvailableInput" id="domainsAvailable" readonly="readonly"></textarea>
<div id='whatDomainDiv' style="font-weight:bold;display:none;">Domain</div>
<div id='isAvailableDiv' style="font-size:5em;display:none;">?</div>
</form>
What I want is to hide <textarea>
until & unless it has some responded value in it.
How can achieve this using jQuery?
Thanks
Upvotes: 1
Views: 871
Reputation: 30217
jQuery(document).ready(function () {
if (jQuery('#domainsAvailable').val() == '') {
jQuery('#domainsAvailable').hide();
}
});
This will hide your text area initially on page load.
Again when in your ajax response you get the text. you will have to write in your success callback.
jQuery('#domainsAvailable').show();
Upvotes: 1
Reputation: 9113
On success ajax call you have to call a method. There you can say display:block
for this text area. And you have to send a response message from the server. That message can be keep inside the text area.
Upvotes: 0