https://github.com/sandersade/jquery.viewsource
jQuery plugin to display HTML source of a page - or a section of a page
https://github.com/sandersade/jquery.viewsource
html-source jquery jquery-plugin viewsource
Last synced: 27 days ago
JSON representation
jQuery plugin to display HTML source of a page - or a section of a page
- Host: GitHub
- URL: https://github.com/sandersade/jquery.viewsource
- Owner: SanderSade
- License: mpl-2.0
- Created: 2017-06-05T07:48:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-05T07:55:36.000Z (almost 9 years ago)
- Last Synced: 2025-03-25T19:46:40.442Z (about 1 year ago)
- Topics: html-source, jquery, jquery-plugin, viewsource
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# viewSource jQuery plugin

## Purpose
Show the source of the current web page or a part of it in its current state. Useful in HTML/JS/CSS demonstration pages, allowing users to easily see your HTML source.
Optional support for the google-code-prettify (http://code.google.com/p/google-code-prettify/) script - you must include prettify.css and prettify.js to your web page.
Includes HTMLEncode (Copyright (c) 2006-2010 Thomas Peri, http://www.tumuski.com/)
## Use
Include the script to your web page: ``. See the [included example](https://github.com/SanderSade/jQuery.viewSource/tree/master/example).
Two methods:
1. Add $(someselector).viewSource(code-to-show-selector); to document.ready. This will bind onclick event to the element(s) specified by your selector - i.e. clicking on those elements will show the source.
2. Call $().showSource(code-to-show-selector); yourself to immediately show the source.
Note: "code-to-show-selector" is optional selector for the element which code to show. If left empty or passed an empty string, it will default to "html", ie. whole page.