S
S
Sketch012018-03-18 05:52:51
css
Sketch01, 2018-03-18 05:52:51

Link href "" and id on click hide and open, How to do?

Help to make the function of opening hidden blocks with id by links href"..." please.
with a certain link, a certain block should open.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mysterion, 2018-03-18
@Sketch01

$('.show_hidden').on('click',function() {
  $id = $(this).data('id');
  $('#'+$id).show();
});

<a href="javscript:void(0)" data-id="1" class="show_hidden">click</a>
<a href="javscript:void(0)" data-id="2" class="show_hidden">click</a>
<a href="javscript:void(0)" data-id="3" class="show_hidden">click</a>
<div id="1" style="display:none;">
block one
</div>
<div id="2" style="display:none;">
block two
</div>
<div id="3" style="display:none;">
block three
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question