Toggle as a basic feature in Front-end development, has been used for lots of modern websites. A lot of times, we need a toggle feature to show and hide a DOM element by clicking on another element, say a button. I believe there are plenty of ways doing it depends on the business requirement. In this article, I would like to share a few tricks that how I do toggle with both jQuery and AngularJS.
1. Here comes in jQuery.
HTML:
<body> <button>Custom</button> <span>From: <input type="text" id="from" />