Guest User

Untitled

a guest
May 25th, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <select id="autoplay">
  2. <option data-autoplay="">no</option>
  3. <option data-autoplay="1">yes</option>
  4. </select>
  5.  
  6. $("#autoplay option:selected").attr("data-autoplay");
  7.  
  8. $("#autoplay option:selected").data("autoplay");
  9.  
  10. var autopplay = $('#autoplay option:selected').attr('data-autoplay');
  11.  
  12. if (!autoplay || autoplay == '') {
  13. // an empty string was returned
  14. }
  15. else if (autoplay == 1) {
  16. /* remember not to trust your users, so validate in/on the server
  17. if you're storing the variable/result...
  18. // 1 was returned
  19. }
Advertisement
Add Comment
Please, Sign In to add comment