I want to use x
jQuery actions on x
number of selectors, based on a variable x
. Each jQuery action should happen for one single selector.
My Jquery code is:
$(document).ready(function () {
$("#less").click(function () {
$("'#industry'+x,#less").hide();
});
});
My pug code is:
-for (x in c){
p(id="industry"+"x") If you click on "Less" button,I will disappear.
p#less Less
-}
I've also tried placing the script inside the loop. Would appreciate your help.
I suggest you hide the text by getting the text relative to the #less link
$(document).ready(function () {
$("#less").click(function () {
$(this).prev('[id^="industry"]').hide();
$(this).hide();
});
});