javascriptjqueryhtmlinputonclick

Click on <div> to focus <input>


I have a series of input elements each with a few <div> tags separate.
I like to have if where I can click on any of the <div> and it will focus on an input.
Is this possible and if so can anyone give ideas on script?


Solution

  • Try this with jquery:

    $('#yourdiv').click(function() {
         $('#yourfield').focus();
    });