문제

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?

도움이 되었습니까?

해결책

Simply:

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

다른 팁

Kicking myself right now!

Just remembered I'd already done it previously.

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

>.<

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top