
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A jQuery module that displays or hides specified elements based on input and data.
A super light & simple jQuery module that displays or hides specified elements based on data.
You can install via npm, yarn, bower, etc.
npm install display-if
js/display-if.js or js/display-if.min.js.
display-if.min.js is a minified version of js/display-if.js. This means that it is a smaller file. If you want to update the scripts contents, then copy js/display-if.js. Otherwise, download the minified version.<script src="your/path/to/display-if.min.js"></script>
<input type="text" name="displayIfText" />
<div class="form-text text-muted display-if"
data-target_name="displayIfText"
data-target_type="text"
data-target_value="debug">
<small>Debug mode: active!</small>
</div>
input[name=displayIfText] has a value of debug, the div above will be visible.To add an option to your display-if element, use the html5 data- tags.
For example, if your option is named option add a data-option='...' tag to your element.
| Option | Description |
|---|---|
| target_name | The name of the form field that the display element depends on. |
| target_class | The class of the form field that the display element depends on. This value is ignored if target_name is present. |
| target_matches_identifier | The name of another form field. If this option is given, then the system will check if [name=data_target_name] has the same value as [name=data_target_matches_identifier] |
| target_type | Default: 'default'. Options: 'text', 'select', 'password', 'radio', 'checkbox', 'default' The type of input. |
| display_if_inverse | Default: false. If true, the display requirements will show the element if the negation of the display_if is satisfied |
| target_value | The value that satisfies the display requirement. If the form field value is equal to the target_value, then the display requirement is satisfied. |
| target_value_not | The value that breaks the display requirement. If the form field value is equal to the target_value, then the display requirement is not satisfied. This is an alias for setting the target_value and displsy_if_inverse=true |
| target_value_can_be_null | Default: false. If true, then the target_value could match with matches_identifiers if both values are null. If false, then each target and match must have some value so satisfy the display requirement. |
Click here for a live demo.

FAQs
A jQuery module that displays or hides specified elements based on input and data.
We found that display-if demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.