I have a jobs website with several different job description pages and with 1 application page with a form.
i.e.
/admin-clark -> /application
/sale-rep -> /application
I would like to pre-populate an input field in the form with the id #jobTitle.
I would like to do the following-
- Get the previous URL
- Store it in local storage
- Sanatize url(remove dashes etc)
- Use jQuery to fill in the field with id jobTitle
Or is a there a better way of doing this?
This is what I have so far
var pathname = window.location.path.replace(/^\?$/, '').toUpperCase();
localStorage.setItem("pathname ", pathname );
$('#jobTitle').val(pathname);