Handy Easy Javascript

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

Javascript can seem daunting for new comers who are learning html and coding for the web. However there are a few dead easy things you can do with javascript which do not require any particularly complicated code and can make your site a bit smoother and slicker for the end user.

Form Submit on Change

A dead easy one to make forms automatically submit when people make a selection on a drop down menu. All you have to do is add onchange=“submit();” into your opening select tag

<form action="index.php"> <select name="view" onchange="submit();"> <option>option1</option><option>option 2</option></select> </form>

Javascript Back Button

another really easy one - you can replicate the functionality of the back button. This is especially handy if you are displaying content in a javascript window without the usual controls.

<a href="javascript: history.go(-1)"><-- Back</a>

Tags: javascripthtmlweb designuser friendly