Skip to content

Added support for non-obstructive usage #12

Closed
wants to merge 1 commit into from

3 participants

@arielpts

Added support for non-obstructive usage, such as:

<input type="checkbox" id="accept">
<label for="accept">Accept!</label>

And

<label>
  <input type="checkbox" id="accept">
  Accept!
</label>
@arthurgouveia
Owner

I liked it! I'll be reviewing this code as soon as I can and I'll merge the pull request, ok?
There's definitely room for improvement here :thumbsup:

Thank you!!

Please, fell free to rewrite/refactor :D

I just got the job done asap...

@arthurgouveia
Owner

Hey, @arielpts! Something just came to my mind.

What if the developer does not want to have his labels changed?
I liked your alternative but I just realised that it can actually remove the possibility of the developer having the choice to use the label he wants, with the styling and other attributes he want.

Maybe add a new option to the plugin, like data-autolabel="true" so that it would get the corresponding label and insert into the wrapping DOM, preserving any attributes it might have.

If set to false, which it would be by default, it would only add a label with a data-label was provided.

In case of data-autolabel="true" and data-label with content, it would clone the corresponding label and add the contents of data-label inside the cloned label.

How does that sound? I might have a given you a bad explanation :)

@markushausammann

sup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.