简体   繁体   中英

How to set checkbox checked when its value is true

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}">

Try

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

use checked = "checked" based on your condition

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM