Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <select id="autoplay">
- <option data-autoplay="">no</option>
- <option data-autoplay="1">yes</option>
- </select>
- $("#autoplay option:selected").attr("data-autoplay");
- $("#autoplay option:selected").data("autoplay");
- var autopplay = $('#autoplay option:selected').attr('data-autoplay');
- if (!autoplay || autoplay == '') {
- // an empty string was returned
- }
- else if (autoplay == 1) {
- /* remember not to trust your users, so validate in/on the server
- if you're storing the variable/result...
- // 1 was returned
- }
Advertisement
Add Comment
Please, Sign In to add comment