Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to get value of attribute "display" and check it in a if statement.
how can i do this?
my code is in blow
$(document).ready(function () {
            $("#pmain").click(function () {
                var n = $("#passchange").attr("display");
                if (n == "block") {


1 solution

Your code for attribute and its check looks correct, but… "display" is not an element attribute, this is something completely different, a CSS property:[^].

Accordingly, in jQuery you should use CSS methods, not attributes:[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900