F
F
FlapJalc2019-01-13 10:38:20
Pug
FlapJalc, 2019-01-13 10:38:20

How to add class for second element via mixin?

This mixin creates a regular field with a label.

mixin field(title)
  p.field
    label(for!=attributes.id).field__label= title
    input(id!=attributes.id class!=attributes.class value!=attributes.value).field__input

With the help attributes, I set certain attributes at the place where the mixin is output.
+field('Дата')(class="page-footer__date-input")(id="date")(value="10.01.2018")

But what if I want to add a unique class not only to inputbut also to label? If I specify in the label class!=attributes.classand then specify the name of the class through the mixin, then the same class will be applied to both the input and the label. How to get out of this situation?
For convenience: CodeOpen

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-01-13
@FlapJalc

The name of the attribute passed to the mixin does not have to match the name of the attribute assigned to the element.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question