Add remove readonly attribute to TextBox based on CheckBox change event using jQuery in ASP.Net
<html xmlns="http://www.w3.org/1999/xhtml">
<head>    <title></title>    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>    <script type="text/javascript">        $(document).ready(function () {            $("#chkRead").change(function () {                if ($(this).is(":checked")) {                    $('#txtFaisalaId').removeAttr("readonly")                }                else {                    $('#txtFaisalaId').attr('readonly', true);                }            });        });    </script></head><body>    <div>        <input id="chkRead" type="checkbox" name="chkRead" /><label for="chkRead">Test</label>        <input name="txtFaisalaId" type="text" readonly="readonly" id="txtFaisalaId" />    </div></body></html>
No comments:
Post a Comment