OnClick Button Display / Hide Div

By March 31, 2020April 11th, 2020No Comments

This snippet is used in Salient when a nectar button style needs an OnClick function for displaying / hiding div. Just remember to include the ID for the div you want to control.

<a onclick="display_div()" class="nectar-button large regular accent-color  regular-button" id="read-disclaimer" style="visibility: visible;" href="#" data-color-override="false" data-hover-color-override="false" data-hover-text-color-override="#fff"&gt;<span&gt;Submit a Listing (I have read the disclaimer above)</span&gt;</a&gt;
function display_div() {
  var x = document.getElementById("divID");
  if ( === "block") { = "none";
  } else { = "block";

Contact us to learn about adopting the web for your business

Jarod Thornton

Author Jarod Thornton

More posts by Jarod Thornton