I am passing a variable called editable from my backend, which holds true or false as the variable. once it is passed to the front end, i have access to it. I want to do something like this:
if ('<%= editable %>' == true) {
//change the input tag (in css) to be able to be edited.
}
i have this code in the <style> tag:
input {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
how can I do this?
Appreciate everyone's comments. I have figured out a very viable solution for this, hopefully it can help everyone in the future.
function test () {
if ('<%= editable %>' != 'yes') {
var x = document.getElementsByTagName("input");
for ( var counter = 0; counter < x.length; counter++){
x.item(counter).readOnly = true
}
}
}
and then onload="test()" in the body tag.