【发布时间】:2021-11-22 18:12:04
【问题描述】:
我是这个社区的新手,非常感谢您的帮助。 这是我的代码行:
<input type="text" class="form-control" id="fines" name="fines" placeholder = "Amount Penalty" required>
我的 Javascript 代码:
$(document).ready (function(){
if($(this).val()==""){
$('#fines').attr('readOnly','false');
}
});
</script>```
The thing that I want to achieve is that when clicking the field with no value it must be editable and if it has a value from the database it will remain a read-only field.
Your help is highly appreciated thank you!!
【问题讨论】:
-
问题需要更多细节。您是否在加载现有数据?
-
请提供足够的代码,以便其他人更好地理解或重现问题。
标签: javascript php html css