Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello.
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
C#
$(document).ready(function () {
            $("#pmain").click(function () {
                var n = $("#passchange").attr("display");
                if (n == "block") {
                    $("#changepass").hide(100);
                }
            })
        });

thank
Posted

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:
http://www.w3schools.com/cssref/pr_class_display.asp[^].

Accordingly, in jQuery you should use CSS methods, not attributes: http://api.jquery.com/category/css/[^].

—SA
 
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