I have the following HTML code:
<input type="text" id="test" ><br>
<button onclick="makeReadOnly('true')">Make read only (ok)</button>
<button onclick="makeReadOnly('false')">Make read/write (not ok)</button>
<button onclick="makeReadOnly(false)">Make read/write (ok)</button>
with this script:
function makeReadOnly(r) {
$("#test").prop("readOnly", r);
}
My problem is: call to makeReadOnly(false)
works, while makeReadOnly('false')
doesn't.
But makeReadOnly('true')
works.
(tested with JQuery 1.9.1)
Who can explain me why ?
http://jsfiddle.net/ym9qe99p/1/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…