ownede/jquery-depends-on
Composer 安装命令:
composer require ownede/jquery-depends-on
包简介
A jQuery plugin to facilitate the handling of form field dependencies
README 文档
README
A jQuery plugin to facilitate the handling of form field dependencies.
$( subject ).dependsOn( dependencySet, [options] );
Examples
Installation
with npm
npm install --save jquery-depends-on
with Bower
bower install --save jquery-depends-on
Download directly
Build from source
git clone https://github.com/dstreet/dependsOn.git
cd dependsOn
npm install
gulp
# --> dist/dependsOn.min.js
Usage
Include jQuery (requires v1.7 or higher)
<script type="text/javascript" src="jquery/jquery-1.7.2.min.js"></script>
Include dependsOn
<script type="text/javascript" src="dependsOn.min.js"></script>
Add form components
<form id="myForm"> <label for="myCheck">Check Me</label> <input type="checkbox" id="myCheck"> <label for="myText">Input</label> <input type="text" id="myText" value=""> </form>
Activate plugin
$('#myText').dependsOn({ // The selector for the depenency '#myCheck': { // The dependency qualifiers enabled: true, checked: true } });
Qualifiers
enabled: (Boolean) If true, then dependency must not have the "disabled" attribute.checked: (Boolean) If true, then dependency must not have the "checked" attribute. Used for checkboxes only.values: (Array) Dependency value must equal one of the provided values.not: (Array) Dependency value must not equal any of the provided values.match: (RegEx) Dependency value must match the regular expression.notMatch: (RegEx) Dependency value must not match the regular expression.contains: (Array) One of the provided values must be contained in an array of dependency values. Used for select fields with the "multiple" attribute.email: (Boolean) If true, dependency value must match an email address.url: (Boolean) If true, Dependency value must match an URL.range: (Array) Dependency value must be within the given range.Custom: (Function) Custom function which return true or false.
Options
disable: (Boolean) Add "disabled" attribute to the subject's form field. Default: truereadonly: (Boolean) Add "readonly" attribute to the subject's form field. Default: falsehide: (Boolean) Hide the subject on disable and reveal the subject on enable. Default: trueduration: (Number) The time in milliseconds for the fade transition. Used only ifhideis set to true. Default: 200trigger: (String) The event used to check dependencies. Default: 'change'onEnable: (Function) The callback function to execute when the subject has been enabled. Default: Empty FunctiononDisable: (Function) The callback function to execute when the subject has been disabled. Default: Empty FunctionvalueOnEnable: (String) The value to set the subject to when enabled.valueOnDisable: (String) The value to set the subject to when disabled.checkOnEnable: (Boolean) If true, "checked" attribute will be added to subject when enabled. If false, "checked" attribute will be removed from subject when enabled. For checkboxes and radio buttons.checkOnDisable: (Boolean) If true, "checked" attribute will be added to subject when disabled. If false, "checked" attribute will be removed from subject when disabled. For checkboxes and radio buttons.valueTarget: (String) jQuery selector for the object to you want to target for editing the value. Use if you want to alter the value of something other than the subject.toggleClass: (String) The class you wish to be appended to the subject when enabled. The class will be removed when the subject is disabled.
Callbacks
When the onEnable and onDisable callbacks are called, this is set to the last triggered dependency, and the function is passed two arguments:
e: The triggering event object$subject: The jQuery object of the subject
Other Libraries
- rails_depends_on - Rails Gem for dependsOn
ownede/jquery-depends-on 适用场景与选型建议
ownede/jquery-depends-on 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ownede/jquery-depends-on 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ownede/jquery-depends-on 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-18