Hide input field when second input field is in focus

This question is out of scope here. You should try stackoverflow for this question.

Though I would like to answer your question.

You need to use some CSS as well as JQuery for getting the desired result.

See the working fiddle here.

Hope this works for you.

CSS addition:

input[type=subscribe]:focus + input[type=search] {
    display:none;
}

JQuery code:

$(function(){
    $("#s").focus(function(){
    $("#subscribe").hide();
    });

    $("#s").focusout(function(){
    $("#subscribe").show();
    });
})