Very simple parameter passing.
Pass.js is a way to send or 'pass' url parameters to form fields. In other words, it captures strings from an address bar and sets them as form values. Great for tracking where your leads are coming from.
- Include the javascript in your documents
<footer>
<footer>
<script type="text/javascript" src="pass.js"></script>
</footer>
- Set the
id
of your field. Also set thisid
inpass.js
.
document.getElementById('your-id').value = getParameter('campaign');
- Finally you will want to specify the string you are parsing for.
document.getElementById('your-id').value = getParameter('your-string');
Full example:
<!-- In your footer -->
<script type="text/javascript" src="pass.js"></script>
<!-- In your form-->
<input id="your-id" name="your-id" type="text"/>
<!-- In your pass.js file-->
document.getElementById('your-id').value = getParameter('your-string');
Pass.js is licensed under the MIT license.