close

how to change attribute “hidden” in jquery

Hello Guys, How are you all? Hope You all Are Fine. Today we are going to learn how to change attribute “hidden” in jquery in javascript. So Here I am Explain to you all the possible methods here.

Without wasting your time, Let’s start This Article.

how to change attribute “hidden” in jquery ?

  1. how to change attribute “hidden” in jquery ?

    change attribute “hidden” in jquery A. Wolff was leading you in the right direction. There are several attributes where you should not be setting a string value. You must toggle it with a boolean true or false.

  2. change attribute “hidden” in jquery

    change attribute “hidden” in jquery A. Wolff was leading you in the right direction. There are several attributes where you should not be setting a string value. You must toggle it with a boolean true or false.

Method 1

$(':checkbox').change(function(){
    $('#delete').removeAttr('hidden');
});

Note, thanks to tip by A.Wolff, you should use removeAttr instead of setting to false. When set to false, the element will still be hidden. Therefore, removing is more effective.

Method 2

A. Wolff was leading you in the right direction. There are several attributes where you should not be setting a string value. You must toggle it with a boolean true or false.

.attr("hidden", false) will remove the attribute the same as using .removeAttr("hidden").

.attr("hidden", "false") is incorrect and the tag remains hidden.

You should not be setting hiddencheckedselected, or several others to any string value to toggle it.

Summery

It’s all About this article. Hope all method helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you? Thank You.

Leave a Comment