Deleted member 66701
D
Deleted member 66701
Hi all.
How do I use a variable in a jquery selector?
I.e. I want to do something like:
$("p(VAR)").hide();
where (VAR) is the variable I want to use.
This is the current code:-
http://testing.frontierwebdesign.co.uk/
How do I use a variable in a jquery selector?
I.e. I want to do something like:
$("p(VAR)").hide();
where (VAR) is the variable I want to use.
This is the current code:-
Code:
<section id="one" class="main style2 right dark fullscreen">
<div class="content box style2">
<header>
<h2>Biography</h2>
</header>
<script>
var counter = 1
console.log(counter, "Hello, world!");
$(document).ready(function(){
$("p2,p3,p4,p5,p6,p7,p8").hide();
$("#next").click(function(){
$("p1").hide();
counter++
console.log(counter, "Hello, world!");
$("p2").show();
});
});
</script>
<p1>Beyoncé Knowles is a multi-platinum, Grammy Award-winning recording artist who's acclaimed for her thrilling vocals, videos and live shows.</p1>
<p2>Bio2</p2>
<br>
<p3>Implement variable to show bio(current)+1 on click event and to hide ≤bio(current).</p3>
<p4>Bio4</p4>
<p5>Bio5</p5>
<p6>Bio6</p6>
<p7>Bio7</p7>
<p8>Bio8</p8>
<br>
<button id="next">Next</button>
</div>
<a href="#two" class="button style2 down anchored">Next</a>
</section>
http://testing.frontierwebdesign.co.uk/
Last edited by a moderator: