I have two divs div1 and div2. I want div2 to be automatically hidden but when i click on preview div then div2 to be mad
div1
div2
preview
You are missing # hash character before id selectors, this should work:
#
$(document).ready(function() { $("#div2").hide(); $("#preview").click(function() { $("#div1").hide(); $("#div2").show(); }); });
Learn More about jQuery ID Selectors