GithubHelp home page GithubHelp logo

derdu / jquery-disabler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dgestep/jquery-disabler

0.0 2.0 0.0 232 KB

A jQuery widget that can completely disable or present a read-only view of the content on your page!

License: GNU General Public License v2.0

jquery-disabler's Introduction

jquery-disabler

You may think that disabling elements on an HTML page is as simple as assigning disabled="disabled" to every element or by invoking a jQuery selector such as $("input").attr("disabled","disabled");, but it's not that simple. What about links or click events assigned to DIV's or tables? When disabling content on a page, you may not want those links or clickable elements to function anymore. Or... maybe instead of disabling your page, you would rather have a display-only version of the contents of your page without having to write two versions of your page; one read-only and the other not. This is where the jQuery Disabler widget can help you out.

The jQuery Disabler widget can be applied on an HTML container (such as a DIV tag) or on individual UI elements and disable or set the contents of the container to read-only, and back again. If acting on an HTML container, the Disabler widget performs a deep-dive scan (evaluates descendants of descendants) of each element inside the container and disables or sets the element as read-only. When disabled or set to read-only, all events are removed from the elements and those elements that usually respond to clicks (such as hyperlinks) become unresponsive. When an enabled or a read-only operation is undone, all removed events are put back and all elements that usually respond to clicks become responsive again.

By using special data attributes and CSS classes, pages can instruct the Disabler plugin to hide elements when disabling, ignore disable requests on certain elements, and change the element to display as text rather than disabling. Disabler also includes support for all of the jQuery UI widgets.

The jQuery Disabler widget is open source and can be downloaded from my GitHub page. You are free to use it as-is or you can download it and modify it for your own use cases.

jquery-disabler's People

Contributors

dgestep avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.