Defaulting the cursor to the First input box on any page.
Cool Stuff, javascriptHere's a short and simple javascript using Jquery to put the cursor in the first text box on a web page. I added this to one of our sites to make sure the cursor starts in the different forms / search boxes on all the pages of our site.
<script>
document.ready(function()){
$("input[type='text']:first").select();
};
</script>It's using Jquery to find the FIRST : INPUT tag with a TYPE="TEXT" on the page. Then it selects it to move the cursor.
QForms + Jquery
javascriptHere is a few interesting tidbits some of you might already know, but I thought it was interesting. I love using qForms. I know I could write my own validation using the forms plugin and other things in JQuery. I have used qForms for so long and have so many applications using it. They actually play nicely together and you get the best of both worlds.
Since QForms needs to be set after the form it can be in the document.ready() section of the web page and it works great. This also allows all your Javascript to be in the same place so you don't have to put it in the page after the form like you do without Jquery.
<script>
document.ready(function(){
objMyForm = new qForm(“frmMyForm”);
objMyForm.myfield_1.required = true;
objMyForm.myfield_1.description = ‘My test Field”;
});
</script>It’s a simple thing but it makes using qForms even easier.





Loading....