Guest User

Untitled

a guest
Aug 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. Is there a simple way to know the starting value of a select?
  2. <select>
  3. <option value='1' selected>one</option>
  4. <option value='2' >Two</option>
  5.  
  6. $("select option[selected]").val()
  7.  
  8. $('select').find('option[selected]').val();
  9.  
  10. $('select').each(function(){
  11. $(this).data('originalValue',$(this).val());
  12. });
  13.  
  14. var def = $("select > option").filter(function () {
  15. return this.defaultSelected;
  16. });
Add Comment
Please, Sign In to add comment