jquery check box checked suppress display hide for text box

Source: Internet
Author: User

Label content

<div class= "box" >
Please write JavaScript code to complete the following function requirements: <br/>
1. After the cancellation of the check, the promotion price, promotion start end Date 3 controls are not available. <br/>
2. When the check box is selected, 3 controls are available for the promotion price, promotion start end date.
</div>
<div class= "box" >

<table id= "table1" class= "MyTable" >
<tr>
<td> whether to promote:</td>
<td><input type= "checkbox" id= "Chkpromote"/></td>
</tr>
<tr>
<td>
Promotion Price:
</td>
<td>
<input type= "text" id= "Txtpromoteprice"/>
</td>
</tr>
<tr>
<td>
Promotion Date:
</td>
<td>
<input type= "text" id= "Txtstart"/>-
<input type= "text" id= "Txtend"/>
</td>
</tr>
</table>
</div>

jquery content

<script>

$ (function () {


$ ("Input[type=text]"). attr ("Disabled", true). Val ("Not Available");

$ ("Input[type=checkbox]"). Click (function () {

var $CR = $ ("Input[type=checkbox]");
if ($CR. Is (": Checked")) {

$ ("Input[type=text]"). attr ("disabled", false). val ("can be used");
}
else {

$ ("Input[type=text]"). attr ("Disabled", true). Val ("Not Available");
}
});


});

</script>

jquery check box checked suppress display hide for text box

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.