How to use JQuery to focus on a specific DIV tag? -


Say I have found some HIV tags in an HTML page like:

  & lt; Div id = "all" & gt; & Lt; DIV id = "div1" & gt; & Lt; Input type = "radio" name = "data ['site1'] ['user']" VALUE = "1" & gt; User1 & lt; Br / & gt; & Lt; / Div & gt; & Lt; DIV id = "div2" & gt; & Lt; Input type = "radio" name = "data ['site1'] ['user']" VALUE = "2" & gt; User2 & lt; Br / & gt; & Lt; / Div & gt; & Lt; DIV id = "div3" & gt; & Lt; Input type = "radio" name = "data ['site1'] ['user']" VALUE = "3" & gt; User 3 & lt; Br / & gt; & Lt; / Div & gt; & Lt; DIV id = "div4" & gt; & Lt; Input type = "radio" name = "data ['site1'] ['user']" VALUE = "4" & gt; User4 & lt; Br / & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

Is it possible to do the same effect in JQuery:

  Document.getElementByID ('div2'). Focus ();  

equals it:

  $ ("# DIV2") focus ();  

But you can focus only on a form element:

  $ ("# div2: input"). Focus ();  

The ID will focus on the first form element inside the element with div2.


Comments