javascript - Press enter on form input to make it lose focus -


i have form input box , hidden submit field:

<form action="javascript:void(0);">     <input type="text">     <input type="submit" style="display:none;"> </form> 

i make when click enter, input box loses focus.

how can accomplish this?

try out. please note need include jquery file work.

<form action="javascript:void(0);">     <input type="text" id="txtfocus">     <input type="submit" style="display:none;" id="btnhidden"> </form> <script> $("#btnhidden").on('click', function() {         $('#txtfocus').blur(); }); </script> 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -