+1 vote
in Other by
Is there anything wrong this code. Tried and tested a hundred times.

<a href="#comment_magic" id="comment_magic_1" name="comment_magic_1" class="u">0 comments</a>

<div id="open_sesame_1" style="display:none" class="open_sesame_1">

test

</div>

jQuery:

$("#comment_magic_1").click(

function () {

$("#open_sesame_1").slideDown();

}, function () {

$("#open_sesame_1").slideUp();

});

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
click() doesn´t take two event handlers.

.click( handler(eventObject) )

handler(eventObject) A function to execute each time the event is triggered.

You can use slideToggle() instead.

$("#comment_magic_1").click(function() {

    $("#open_sesame_1").slideToggle();

});

Related questions

+1 vote
asked Feb 1, 2022 in Other by DavidAnderson
+1 vote
asked Jan 30, 2022 in Other by DavidAnderson
...