Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaue/jquery-lock
:lock: jQuery Plugin that prevents html changes
https://github.com/kaue/jquery-lock
javascript jquery-lock jquery-plugin lock
Last synced: about 2 months ago
JSON representation
:lock: jQuery Plugin that prevents html changes
- Host: GitHub
- URL: https://github.com/kaue/jquery-lock
- Owner: kaue
- License: apache-2.0
- Created: 2015-05-04T22:16:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-23T21:38:39.000Z (over 3 years ago)
- Last Synced: 2024-04-14T14:04:40.841Z (9 months ago)
- Topics: javascript, jquery-lock, jquery-plugin, lock
- Language: JavaScript
- Homepage: http://kauegimenes.github.io/jquery-lock/
- Size: 92.8 KB
- Stars: 30
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jQuery Lock Plugin
With this jQuery plugin you will be able to prevent some users from changing content in your page, using the Chrome Developer Tools for example.[Demo](http://kaue.github.io/jquery-lock/)
## Basic Usage
```html$( document ).ready(function() {
$("h1,p").lock();
});I am locked =)
I am locked too!
```## Options
You can customize the behavior of the plugin using this options:- `alertMessage` (String)
Send a custom alert for every change on the locked elements
#### Sample
```javascript
$("h1,p").lock({
alertMessage: "You can`t change this."
});
```
- `customHandler(element, updatedHtml, savedHtml)` (Function)Change the behavior of the plugin, insted of replacing every change with the `savedHtml`.
#### Sample
```javascript
$("h1,p").lock({
customHandler: function(element, updatedHtml, savedHtml) {
//Block the change
$(element).html(savedHtml);
//Do something else with the updatedHtml
console.log('Change blocked %s', updatedHtml);
}
});
```