I have a Web form built in Gravity Forms that is working quite well, But the users would like me to force Focus into the first field on the form when the form opens. I thought I could do this with a javascript function but it does not seem to work .. I know I am missing something just not sure what - Hopefully someone will see the error of my ways (code) and can point me in the right direction.. The function on keypress works the function to set the focus initially does not. Looking at the .ready documentation, but not sure that is the way I need to go.
[code]
<script type="text/javascript">
jquery(function($){
$('input[name=Badge]').focus();
});
jQuery(function($){
$("form").keypress(function(e) {
//Enter key
if (e.which == 13) {
return false;
}
});
});
</script>
[/code]
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.