<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script src="js/jquery-1.8.3.js"></script> <script> /*$(function(){ $("p").click(function(){ $("p").toggle(); }); });*/ window.onload=function(){ document.getElementById("p1").onclick=function(){ if(document.getElementById('p2').style.display=="none"){ document.getElementById("p2").style.display="block"; }else{ document.getElementById("p2").style.display="none"; } } } </script> </head> <body> <p style="display: block;" id="p1">Hello wold</p> <p style="display: block;" id="p2">Hello</p> </body> </html>