hashsplit is JS plugin to use various values from URL fragment identifier (hash) #foo , #foo/bar or #foo=bar&city=springfield
It uses the values from the hash with DOM-Id in a specific way:
- forms (inputs, selects) are filled (works only with pseudogets
&name=value
or/name=value
)- checkbox get checked on 'true' or any string, but unchecked with 'false' or '' (empty string) only.
- links (
a
) get a click (e.g. you want to link on a page with an active fancybox)
<script src="https://cdn.jsdelivr.net/gh/klml/hashsplit@master/hashsplit.js" type="text/javascript"></script>
<script>
document.addEventListener('readystatechange', event => {
hashsplit(); // activate hashspilt
updateHash(); // get changed input values back to hash
})
</script>
Initial JS from Cristian Sanchez on stackoverflow.com. accounts.google.com is using the function 'InputHolder.prototype.prefill' doing similar the same as this function 'HashSplit'.
Any ideas for:
- img
- formassembly
- jQuery BBQ
- contactform7 for wordpress Getting Default Values from the Context
- stackoverflow questions on this:
- 1.0
- 3.0 removed tabs, use CSS :target
- this
- hooks
- alert