In many cases we do not want make two buttons to show or hide a same div area. for example expand and collspan method. jQuery provides a simple technique to check div id is already shown or hidden. Create a div are on which you want to do operation: Click on me Content will be…