0

Tenho o seguinte trecho de código:

$(".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" />

Perceba que ao clicar no botão o item2 deveria ser exibido, mas não tem funcionado. Por que isso ocorre e como resolver?

2 Respostas 2

3

Seu erro está aqui: $("#show").chick(function(){ "chick" o correto é 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" />

1
  • @jedaiasrodrigues Por favor revisar o código antes!
    – Igor Mello
    12/04/2016 às 21:05
3

Você estava usando .chick ao invés de click. Tenta agora.

$(".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" />

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .