select box get selected value onload

select box get selected value onload

Hi !

this code actually works for me but only  when select box change

  1. jQuery(function($) {
  2.     ///////////////////////////////
  3.     $( "#selectbox" ).change(function() {
  4. var country = $('#selectbox').val();
  5. if(country == 'extra'){
  6. $('#selectbox-extra').attr('data-hidden', 'show');
  7. } else{
  8. $('#selectbox-extra').attr('data-hidden', 'hidden');
  9. }
  10. });    
  11. /////////////////////
  12. });

I want to check onload AND onchange if  option = 'extra' is selected and then apply or not $('#selectbox-extra').attr

thanks to all !