Jquery Show does not work in td

Asked

Viewed 139 times

0

I have the following code snippet:

$(".item2").hide();

$("#show").chick(function(){
	$(".item2").show();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table border="1">
<tr>
  <td>Item1</td>
  <td class="item2">Item2</td>
</tr>
</table>
<br/>
<input type="button" value="show" id="show" />

Note that by clicking the item2 should be displayed but has not worked. Why this occurs and how to resolve?

2 answers

3

Your mistake is here: $("#show").chick(function(){ "chick" the correct is click.

$(".item2").hide();

$("#show").click(function(){
	$(".item2").show();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table border="1">
<tr>
  <td>Item1</td>
  <td class="item2">Item2</td>
</tr>
</table>
<br/>
<input type="button" value="show" id="show" />

  • @jedaiasrodrigues Please review the code first!

3

You were using . Chick instead of click. Try now.

$(".item2").hide();

$("#show").click(function(){
	$(".item2").show();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table border="1">
<tr>
  <td>Item1</td>
  <td class="item2">Item2</td>
</tr>
</table>
<br/>
<input type="button" value="show" id="show" />

Browser other questions tagged

You are not signed in. Login or sign up in order to post.