javascript - Programatically enable iOS keyboard on orientation change -


i'm building website responsive design goes between mobile , desktop view if viewport big/small enough. because of this, have 2 search bars (mobile , desktop). on ipad, want able rotate screen while focusing on 1 search bar, , other focused on automatically, including keyboard.

here's have going in script right now:

window.onorientationchange = function() {         $('input').css('cursor', 'pointer');          if($('.search-input-mobile').css('display') != 'none' && $('.search-input').css('display') == 'none' && $('input:focus').length > 0 && math.abs(window.orientation) != 90) {             $('.search-input-mobile').trigger('click');         } else if(math.abs(window.orientation) === 90 && $('input:focus').length > 0 ) {                 $('.search-input').trigger('click');         } else if($('input:focus').length > 0 ) {             $('.search-input-mobile').trigger('click');         }     };      $('.search-input').click(function(e){         alert('got desktop');         document.activeelement.blur();         $('.search-input-mobile').blur();         var temp = $('.search-input-mobile').val();         $('.search-input').val('');         $('.search-input').val(temp);         $('.search-input').focus();         e.preventdefault();     });      $('.search-input-mobile').click(function(e){         alert('got mobile');         document.activeelement.blur();         var temp = $('.search-input').val();         if (temp != '') {             $('.search-input-mobile').val('');             $('.search-input-mobile').val(temp);         }         $('.search-input-mobile').focus();         e.preventdefault();     }); 

i've tried pretty can find on no avail. know how accomplish this? side note, avoid libraries if @ possible.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -