Pregunta

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?

¿Fue útil?

Solución

Simply:

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

Otros consejos

Kicking myself right now!

Just remembered I'd already done it previously.

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

>.<

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top