javascript - How to prevent the keyboard from popping up on mobile devices? -
http://api.jqueryui.com/spinner/
i trying use jquery spinner above in website (a demo of available @ bottom of api).
it works work on computers, on mobile devices, keyboard annoyingly pops every time 1 clicks up/down buttons. possible prevent happening? spinner not respond native functions .on('click'), instead has own functions.
how modify code keybooard shows when textbox clicked, not up-down buttons?
this attempt, not work:
$( function() { $('.ui-spinner a').on('click', function() { $(':focus').blur(); }); }) // updated code, can see focus being lost on desktops, still not mobile devices
note: got class name inspecting code generated when spinner created.also, super new web development not sure whether missing easy approach.
when step button clicked, input focus, mobile device display keyboard, solution add readonly attribute, when user click input box, remove it, on blur, add readonly attribute again.
see code snippet understand, sorry english not enough describe
$( "#spinner" ).spinner(); $( "#spinner" ).click(function(event){ $(this).removeattr('readonly').select(); }); $( "#spinner" ).blur(function(event){ $(this).attr('readonly', 'readonly'); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js" integrity="sha256-ege6blurk5shj+rmkfsgyekyzx3m4bg+zlfya7kns7e=" crossorigin="anonymous"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <input id="spinner" >
Comments
Post a Comment