Hide or show for different paragraphs

Hello, I have two paragraphs. I want to click one to show, the other to hide. But if I click the hide part, all are hidden.
Jquery question.

Thanks for advice.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="../Users/hzhao/Downloads/jquery-1.6.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<h2>This is a heading</h2>
<p id="show">This is a paragraph.</p>
<p id="hide">This is another paragraph.</p>


Open in new window

Who is Participating?
You want them to toggle each other?

HainKurtSr. System AnalystCommented:
your request is logically impossible. do you want something like this?

p1 : show p2
p2 : hide p1

anyway, maybe you are looking for this

$("p hide").hide();
$("p show").show();
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.