I just would like to add the 'autobuffer' attribute to my video tag using javascript.
Basically:
var video = document.createElement('video');
video.addAttribute('autoBuffer');
And I'll have:
<video autoBuffer></video>
I tried:
video.setAttribute('autoBuffer'); => <video autoBuffer="undefined"></video>
Which is wrong...
The second parameter to setAttribute
must be a string always - currently the undefined
you're implicitly passing is converted to one. Use
video.setAttribute('autoBuffer', '');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.