Я пытаюсь сделать функцию show/hide с некоторыми контейнерами и текстом. Когда я нажимаю на определенный контейнер, я хочу скрыть абзац. На данный момент я пытаюсь работать, когда я нажимаю контейнер "left"
, абзац "barbertext"
исчезает.Javascript показать и скрыть функцию
<p class="hairtext" style="color:red">We are Thairapy, an independent hair <br> and beauty Salon located in the heart<br> of Exeter. At Thairapy, we care about<br> our clients and our main aim is to go<br> that extra mile and look after every <br> one of our happy customers.</p>
<p class="beautytext" style="color:red">Our beautician, Shail Dutt has over<br> 10 years of experience within the beauty<br> industry. Shail is a very dedicated and<br> passionate person, she strives to make<br> her clients feel loved and special. </p>
<p class="barbertext" style="color:red">A decent Mens haircut needn't cost the<br>Earth. We offer top quality Men's haircuts<br> from £7. </p>
<div class="container" id= "left" >
<h1 style="color:white"><a>HAIR</a></h1>
</div>
<div class= "container" id= "center">
<h1 style="color:white"><a>BEAUTY<a/></h1>
</div>
<div class="container" id= "right">
<h1 style="color:white"><a>BARBERS</a></h1>
</div>
</div>
The Javascript, что я работаю с такой:
<script>
$(document).ready(function(){
$("#hairtext").click(function(){
$("barbertext").hide();
});
$("#hairtext").click(function(){
$("barbertext").show();
});
});
</script>
Если кто-то может помочь мне бы очень признателен.
вам не хватает. для класса barbertext: $ (". barbertext"). hide(); – mezod