Hi,
I'm quite a noob at Jquery but I'm trying to set a variable based on the name of a form element.
I.e. variable = "someForm" based on this example:
<form id="hello" name="someForm" >
First name: <input type="text" name="firstname" />
Last name: <input type="text" name="lastname" />
Email: <input type="text" name="email" />
<input type="submit" value="Subscribe" />
</form>
I'm using the following code which doesn't seem to work:
var formName = 0;
$('input').parentsUntil('form', this).focus(function() {var formName = this.name;})
if (stTime == 0) { // This ensures someone cannot start a form multiple times
var stTime = new Date();
stDelay = stTime - loTime;
alert(formName);
}
Thanks in advance!