Like with attribute disable on the <input> html tag.
I’m not interested in the effects of disabling, like not being included in a POST of the form, and the styling could of course be redone in css, if it should just look disabled. (And my input field is a submit button, so disabling from POST is irrelevant.)
I just need it to be unclickable and to look disabled.
Is that possible in pure css without adding the attribute on the html tag?
No you cannot disable the functionality of it via just CSS (since it is there just for styling purposes), though you can make it appear greyed out like a disabled button using CSS. To make it disabled in terms of functionality, you will have to resort to JavaScript.
With CSS all you can do is to style your button greyed out via CSS and then create another element over it making its
z-indexhigher, settingpositionandopactiyto fully transparent. This would mean your actual element is enabled but one will not be able to click it because of element over it with full transparency.Another solution is to just add
pointer-events: none;to the style of the dom element, should work on most of the browsers.