<head>
<script>
function hide(str)
{
var elem = document.getElementById(str);
elem.style.display = 'none';
}
</script>
</head>
<body>
<h2 align="center">Using the display property of CSS</h2>
<a href="#" onclick="hide(this.id);" id="1">Here is some text which I want to hide</a>
<a href="#" onclick="hide(this.id);" id="2">Here is some text which I want to hide</a>
<a href="#" onclick="hide(this.id);" id="3">Here is some text which I want to hide</a>
</body>
</html>
Note: This code also be used by putting ID s for div, table, tr and so on.. In the same time you are also able to call onclick function by setting them in a button. As you know in above I put id and I also called function in same anchor tag, if you observe. I hope this code is very useful for you. Happy coding