Adam Pavlov
Adam Pavlov

Reputation: 307

How to select current selector and other selector

Bellow example working well but in this example I want to select "#btn-create" as "this" to hide it. Means when I click on "btn-create" button it should hide with given ID and Class.

$("#btn-create").click(function(){
   $("#btn-create, #add-goal-form, .custom-file-upload").hide();
   $(".add-goal-feedback, #btn-complete").show();
});

Upvotes: 0

Views: 45

Answers (1)

Developer107
Developer107

Reputation: 1758

try using add() function of jquery which will create a group of elements and then execute .hide() functionality on that group -

$(this).add(" #add-goal-form, .custom-file-upload").hide();

Upvotes: 3

Related Questions