Forum Moderators: open

Message Too Old, No Replies

Getting the current form element with JS

         

Nutter

3:09 pm on Jun 2, 2005 (gmt 0)

10+ Year Member



Is it possible with JS to tell what form field is selected?

rocknbil

3:12 pm on Jun 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about onFocus="setSomeVariable_or_perform_someAction();"?

var sel; // Declare variable
<input type="text" id="fname" name="fname" onFocus="sel=this;">

<input type="text" id="fname" name="fname" onFocus="chkField(this);">

Nutter

3:37 pm on Jun 2, 2005 (gmt 0)

10+ Year Member



I'm kinda hoping for something that's not going to require me to add something to the 50 or so form elements. If that's the only way, I'll do it; but I was hoping for something quick & easy :-)

rocknbil

3:52 pm on Jun 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well check back, there are certainly some sharp heads here that know much more than I, they'll be around. :-)