jQuery <1.9
$('#inputId').attr('readonly', true);
jQuery 1.9+
$('#inputId').prop('readonly', true);
Read more about difference between prop and attr
More Related Contents:
- Adding The Anchor Text As The Title Dynamicaly
- Format date to MM/dd/yyyy in JavaScript [duplicate]
- How to prevent a click on a ‘#’ link from jumping to top of page?
- How do I refresh a page using JavaScript?
- One time page refresh after first page load
- How to get client IP address using jQuery
- My javascript is returning this error: $.ajax is not a function
- Detect Close windows event by jQuery
- Retrieving file names out of a multi-file upload control with javascript
- jQuery change event on not firing in IE
- How to disable Chrome’s saved password prompt setting through JavaScript
- Input field for Tags separated by comma
- Only on Firefox “Loading failed for the with source”
- Center flex item in container, when surrounded by other flex items
- jQuery load content when scroll to bottom-100px of page, multiple events fired
- jQuery: How to listen for DOM changes?
- Using jQuery, how do you find only visible elements and leave hidden elements alone?
- Remove all attributes
- Clone a file input element in Javascript
- How to get the image size (height & width) using JavaScript
- submit event does not fire if submit initiated programmatically
- jQuery plugin DataTables: How to highlight the current search text?
- Add CSS rule via jQuery for future created elements
- How can I remove wrapper (parent element) without removing the child?
- Jquery getJSON cross domain problems
- closure inside a for loop – callback with loop variable as parameter [duplicate]
- How to implement hierarchical multilevel datatable in javaScript?
- How to select empty inputs (value=””) using jQuery
- jQuery uses (new Function(“return ” + data))(); instead of eval(data); to parse JSON, why?
- How to get html source code from external url