javascript - Focus on a form field with a variable -
i have relatively simple issue i'm trying resolve , can't seem find it.
i working on existing product, after error modal closed need focus on given form field, @ point have stored in variable.
currently works:
$("input[field='number']").focus();
i've simplified variable names. no have variable below;
myfield = 'number'
but attempts focus on failing, i've tried:
$("input[field=myfield]").focus(); $("input[field='myfield']").focus();
as said i've had around sadly cannot find need. appreciated.
thanks
you using variable name instead of contents.
try this
$("input[field='" + myfield + "']").focus();
Comments
Post a Comment