2016-04-26 6 views

答えて

5
document.getElementById("myTextarea").readOnly = "true"; 
+0

'readOnly'が[ブール](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement)properyので、それはおそらくあるべきです'true'ではなく' 'true''です。 –

0

jsfiddle:https://jsfiddle.net/kenhkw3s/

HTML:

<textarea id="details"></textarea> 

スクリプト:

document.getElementById("details").readOnly = "true"; 
0
function readOnlyTextArea(idTextArea){ 
    document.getElementById(idTextArea).readOnly = "true"; 
}; 

Demo

関連する問題