How to disable click on the button ( <input type="image"> ) if the checkbox is not active ( <input type="checkbox"> )?
The solution should be in pure CSS.
) if the checkbox is n...">
How to disable click on the button ( <input type="image"> ) if the checkbox is not active ( <input type="checkbox"> )?
The solution should be in pure CSS.
Itβs possible to ban css, as it turned out, with the pointer-events option in the answer @ zenden2k.
There are 2 options without a ban:
Hide the button altogether until it is checked
input + button { display: none; } input:checked + button { display: inline; } <label for="check">Π§Π΅ΠΊΠ±ΠΎΠΊΡ</label> <input id="check" type="checkbox" /> <button>ΠΠ½ΠΎΠΏΠΊΠ°</button> Show the stub instead of the button until it is checked
input + button { display: none; } input:checked + button { display: inline; } input:checked + button + button { display: none; } <label for="check">Π§Π΅ΠΊΠ±ΠΎΠΊΡ</label> <input id="check" type="checkbox" /> <button>ΠΠ½ΠΎΠΏΠΊΠ°</button> <button disabled="disabled">ΠΠ½ΠΎΠΏΠΊΠ°</button> input+input { opacity: .5; pointer-events: none; } input:checked+input { opacity: 1.0; pointer-events: auto; } <input type="checkbox"> <input type="image"> Source: https://ru.stackoverflow.com/questions/467118/
All Articles