https://github.com/klml/hashsplit
hashsplit is a JS plugin to use values from URL fragment identifier (hash) #foo , #foo/bar or #foo=bar&city=springfield.
https://github.com/klml/hashsplit
hash url-fragment-identifier
Last synced: 9 months ago
JSON representation
hashsplit is a JS plugin to use values from URL fragment identifier (hash) #foo , #foo/bar or #foo=bar&city=springfield.
- Host: GitHub
- URL: https://github.com/klml/hashsplit
- Owner: klml
- License: mit
- Created: 2014-04-08T10:06:25.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-06-03T16:27:03.000Z (over 2 years ago)
- Last Synced: 2025-02-12T08:40:53.732Z (11 months ago)
- Topics: hash, url-fragment-identifier
- Language: HTML
- Homepage: https://klml.github.io/hashsplit/
- Size: 34.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
hashsplit
=========
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)
[Demo](https://klml.github.io/hashsplit/)
## usage
```
document.addEventListener('readystatechange', event => {
hashsplit(); // activate hashspilt
updateHash(); // get changed input values back to hash
})
```
## inspiration
Initial JS from [Cristian Sanchez on stackoverflow.com](http://stackoverflow.com/questions/3729150/retrieve-specific-hash-tags-value-from-url). [accounts.google.com](https://accounts.google.com/SignUpWithoutGmail#FirstName=John&LastName=Doe&EmailAddress=example@example.com) is using the function 'InputHolder.prototype.prefill' doing similar the same as this function 'HashSplit'.
Any ideas for:
* img
## similar usage
* [formassembly](http://help.formassembly.com/knowledgebase/articles/340353-prefill-through-the-url)
* [jQuery BBQ](http://benalman.com/projects/jquery-bbq-plugin/)
* contactform7 for wordpress [Getting Default Values from the Context](http://contactform7.com/getting-default-values-from-the-context/)
* stackoverflow questions on this:
* [Pre-fill form field via URL in html](http://stackoverflow.com/questions/14070105/pre-fill-form-field-via-url-in-html)
* [Prefill form through url](http://stackoverflow.com/questions/29047386/prefill-form-through-url) with this [clientside working form](http://tumblr.followd.co.nz/login.php?email=masterofcoins)
## version
* 1.0
* 3.0 removed tabs, use [CSS :target](//developer.mozilla.org/en-US/docs/Web/CSS/:target)
## todo:
* this
* hooks
* alert