Friday, April 19, 2024
HomejQueryConceal Components As soon as Expiry Date/Time Is Reached - jQuery jqExpire

Conceal Components As soon as Expiry Date/Time Is Reached – jQuery jqExpire


jqExpire is a tiny jQuery plugin that permits you to mechanically conceal any specified parts after an expiration date/time.

Typically you need to show info in your website that solely must be proven throughout specific occasions. An instance is perhaps occasion timetables or notices with deadlines. It is good observe to not completely show this type of info on the idea that guests will not be getting round to viewing it.

This plugin gives you the power to handle time-sensitive content material, which must be eliminated as soon as it has expired. This may be helpful for pages with upcoming/ongoing occasion notices or varieties which have a cut-off time. 

The way to use it:

1. Obtain and cargo the jquery.jqExpire.js after jQuery.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/jquery.jqExpire.js"></script>

2. Specify the expiration date within the data-expire attribute.

<div data-expire="2022-12-25">
  <p>This ingredient must be hidden after 2022-12-25.</p>
</div>

<div data-expire="2021-12-25">
  <p>This ingredient must be hidden now.</p>
</div>

3. Initialize the plugin and achieved.

$(perform(){
  $().jqExpire();
});

4. You may as well specify the expiration date within the JavaScript throughout init.

<div id="instance">
  <p>This ingredient must be hidden after 2022-12-25.</p>
</div>
$(perform(){
  $('#instance').jqExpire('2022-12-25');
});

This superior jQuery plugin is developed by aalaap. For extra Superior Usages, please test the demo web page or go to the official web site.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments