Home > front end >  How to set checkbox checked when its value is true
How to set checkbox checked when its value is true

Time:11-28

The problem I'm now encourting is that my checkbox isnt being checked when my value returns a value "true". May I know how I am able to set the checkbox is checked if its true and unchecked if its false.

 <input type="checkbox" name="s1syslog_enabled" id="s1syslog_enabled" value="${requestScope.data}">

CodePudding user response:

Try

value="${requestScope.data?'checked':''}"

CodePudding user response:

use checked = "checked" based on your condition

  • Related