Render Label After Select Element

Notice: This thread is very old.
liko28s
Member | 6
+
0
-

Hi guys, currently I perform various forms using Materialize as front-end framework , the way in which you should write the element is as follows :

<div class="input-field col s12">
    <select>
      <option value="" disabled selected>Choose your option</option>
      <option value="1">Option 1</option>
      <option value="2">Option 2</option>
      <option value="3">Option 3</option>
    </select>
    <label>Materialize Select</label>
 </div>

Using Nette:

$form->addSelect('id_type', 'Materialize Select', array(
            '' => Nette\Utils\Html::el('option')->value('')->setHtml('Choose your option')->disabled(TRUE),
            "1" => 'Option 1',
            '2' => 'Option 2',
            '3' => 'Option 3'
        ))
            ->setValue('');

The problem is that Nette render the label first, distorting the viewing.

there any way that the element label render first?

liko28s
Member | 6
+
0
-

Hi Guys, I solved my problem, just adding

$(".select-wrapper").parent().find('label').addClass('active');

In Materialize
Thanks.