[英]How to make a text input field “readonly” using javascript / html?
I want to customize my Jira and need to set a text input field to readonly in javascript / html.我想自定义我的 Jira,需要在 javascript / html 中将文本输入字段设置为只读。 I got the following code already, which sets a default value into my customfield "summary":
我已经得到了以下代码,它在我的自定义字段“摘要”中设置了一个默认值:
window.ATL_JQ_PAGE_PROPS = $.extend(window.ATL_JQ_PAGE_PROPS, {
triggerFunction: function(showCollectorDialog) {
$('#feedback-button').on( 'click', function(e) {
e.preventDefault();
showCollectorDialog();
});
},
fieldValues: {
summary : 'Solution'
}
});
</script>
Next step would be to also set the "summary" to readonly, so users can't modify my predefined title anymore.下一步是将“摘要”设置为只读,这样用户就不能再修改我的预定义标题了。 I already tried "document.getElementById("summary").setAttribute("readonly", true);"
我已经尝试过“document.getElementById("summary").setAttribute("readonly", true);" and similar stuff but it didn't work out.
和类似的东西,但没有成功。 Mayb I did something wrong since I'm not a programmer and someone has an advice?
也许我做错了什么,因为我不是程序员,有人有建议吗?
Thanks in advance提前致谢
<input type="text" value="static value" readonly>
you can do this with read only property it prevent the all type of changing您可以使用只读属性执行此操作,它可以防止所有类型的更改
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.