How to make readonly textbox using Jquery

Sometimes making a textbox readonly is project need. There are 2 ways to make textbox readonly using jQuery.

Method 1:

<script type="text/javascript">
   $(document).ready(function(){
      $("#<%=txtName.ClientID %>").focus(function () {
             $(this).blur();
      });
   });
</script>
See live Demo and Code

Method 2:

<script type="text/javascript">
   $(document).ready(function(){
      $("#<%=txtName.ClientID %>").attr('readonly', true);
   });
</script>

Feel free to contact me for any help related to jQuery. I will gladly help you.