本文介紹了使用 CSS 禁用文本框的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
如何在 CSS 中禁用文本框?目前,我們的視圖中有一個文本框,可以根據(jù)模型中的屬性啟用/禁用它.我們有 asp.net MVC 視圖;根據(jù) Model 屬性的值,我們需要渲染文本框或只讀文本框.我們正在考慮通過將 CSS 應用于視圖控件來做到這一點.以前有人做過嗎?
How to disable a textbox in CSS? Currently we are having a textbox in our view which can be enabled/disabled depending on a property in the model. We are having asp.net MVC view; depending on the value of the Model property we need to either render a textbox or readonly textbox. we were thinking of doing this by applying CSS to the view control. Has someone done this earlier?
推薦答案
CSS 無法禁用文本框,但是您可以關閉顯示或可見性.
CSS cannot disable the textbox, you can however turn off display or visibility.
display: none;
visibility: hidden;
或者你也可以設置HTML屬性:
Or you can also set the HTMLattribute:
disabled="disabled"
這篇關于使用 CSS 禁用文本框的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!