Pergunta

This is more than likely going to be straight forward, or convoluted, but here goes...

How do you add a data attribute to a form element?

Foi útil?

Solução

Simply:

$element->setAttribute('data', 'somedata');

Outras dicas

Kicking myself right now!

Just remembered I'd already done it previously.

...
'attributes' => array(
    ...
    'data-xxx' => '',
    ...
),

>.<

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top