Add Label element without using Caption

48 views
Skip to first unread message

Mazolo

unread,
Oct 2, 2013, 9:33:43 AM10/2/13
to jquery...@googlegroups.com
I would like to wrap a label to a span element. The label is for a text input. I can add a label but how do I show innerHTML?

Daff

unread,
Oct 2, 2013, 10:02:11 AM10/2/13
to jquery...@googlegroups.com
You can just pass an object as the caption element:

{
  type: 'text',
  caption: {
    html: {
      type: 'span',
      html: 'Something something'

Mazolo

unread,
Oct 3, 2013, 10:01:37 AM10/3/13
to jquery...@googlegroups.com
Thanks Daff for prompt response, however, I end up having a span inside a label. What I would like to achieve is a label inside a span so I can do some formatting on the span element. I want to create something like this:
 
<span>Login</span> <span><input type=text</input></span>
 
One option is to omit caption on text input so it does not display label then how do I put caption (innerHtml) within span element. html does not seem to work with span element.
 
Thanks again.

Daff

unread,
Oct 3, 2013, 10:34:07 AM10/3/13
to jquery...@googlegroups.com
I don't see a label tag at all in your example. You can however either overwrite the caption subscriber (look at the original code at https://github.com/daffl/jquery.dform/blob/master/src/dform.core.js#L146) to create a span or just create the structure yourself:

{
  type: 'span',
  html: 'Login'
Reply all
Reply to author
Forward
0 new messages