Disable a textbox using CSS

Balaji picture Balaji · Mar 16, 2010 · Viewed 268.1k times · Source

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?

Answer

abbie picture abbie · Mar 27, 2012

you can disable via css:

pointer-events: none; 

Doesn't work everywhere though.