131
rated 0 times
[
134]
[
3]
/ answers: 1 / hits: 8205
/ 10 Years ago, thu, july 24, 2014, 12:00:00
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);
More From » jquery