Setting a radio button "checked"

56 views
Skip to first unread message

David Smith

unread,
Apr 9, 2013, 6:33:17 PM4/9/13
to enliv...@googlegroups.com
I have a group of radio buttons typically like:
  <input type="radio" name="pauseRadio" id="pause"/>

I need to mark some of them "checked":
  <input type="radio" name="pauseRadio" id="pause" checked/>

set-attr isn't appropriate, and I can't seem to get syntax right to use "after" or "before" - I'm sure there's a very obvious way to do this that I'm not seeing.

Thanks for any help.

David

Xavi Caballé

unread,
Apr 9, 2013, 6:45:39 PM4/9/13
to enlive-clj
But an empty 'checked' attribute is equivalent to
checked="checked"
(see http://www.w3.org/TR/html-markup/input.checkbox.html)
Knowing that, I guess set-attr will work for your purpose.

xavi
> --
> You received this message because you are subscribed to the Google Groups
> "Enlive" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to enlive-clj+...@googlegroups.com.
> To post to this group, send email to enliv...@googlegroups.com.
> Visit this group at http://groups.google.com/group/enlive-clj?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

David Smith

unread,
Apr 9, 2013, 7:23:54 PM4/9/13
to enliv...@googlegroups.com
Thank you, Xavi - 

I hadn't realized that set-attr would not only set a value for an existing attribute, but would add a new one.

Thanks, again.

David
Reply all
Reply to author
Forward
0 new messages