0

I am working on a web app for display on iPhone and when the form field becomes active, the nav (.nav-btns) at the bottom of my page gets in the way. I'd like to hide that element when any form element becomes in focus. Here's what I've currently tried with jquery, but no luck:

<script type="text/javascript">
$( document ).ready(function() {
$("select").is(":focus").hide(".nav-btns");
});
</script>
chuckscoggins
  • 33
  • 2
  • 10
  • Maybe [this][1] post can help. It seems it's a webkit issue. [1]: http://stackoverflow.com/questions/3272089/programmatically-selecting-text-in-an-input-field-on-ios-devices-mobile-safari – Mojtaba Amiri Sep 22 '13 at 22:59

1 Answers1

5

How about:

$(function(){

  $('select').focus(function(){

    $(".nav-btns").hide();

  });
});

This should bind the focus event to all of your select elements, and then hide the element with the class .nav-btns.

For undoing the change on an 'unfocus':

$(function(){

  $('select').focus(function(){

    $(".nav-btns").hide();

  }).blur(function(){

    $(".nav-btns").show();

  });
});
shennan
  • 10,798
  • 5
  • 44
  • 79