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> 
1

1 Answer 1

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(); }); }); 
Sign up to request clarification or add additional context in comments.

1 Comment

This worked great. Any ideas how to make the element return once the select is no longer in focus?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.