Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. var selvalues = $(this).val(); //["AS", "US", "CA"]
  2.  
  3. $('#countriesSelect').on('change', function(){
  4.  
  5. var selvalues = $(this).val();
  6.  
  7. console.log(selvalues .some(x => x !== 'US' && x == 'US'));
  8.  
  9. if(selvalues.includes('US') || !selvalues.includes('US')){
  10. console.log('You cannot choose a foreign country when current selection is US');
  11. }
  12. if($.inArray("US",selvalues) != -1){
  13. $('#usregions').show().fadeIn();
  14. if($.inArray("US",selvalues) != -1){}
  15. } else {
  16. $('#usregions').hide().fadeOut();
  17. }
  18. $.each(selvalues, function( index, value ) {
  19. console.log()
  20. if(value == 'US' && value != 'US'){
  21. console.log('You cannot choose a foreign country when current selection is US');
  22. }
  23. });
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement