2

I want to get value of div attribute. Like I want to know whether the div is "display:block;" or "display:none" at the time of page load. If "display:block;" then it will be "display:block;" after the page load again if not then "display:none". Can anyone help me with jquery method or code?

Luka Krajnc
  • 915
  • 1
  • 7
  • 21
Faizan
  • 1,132
  • 2
  • 12
  • 23
  • 2
    $(document).ready(function(){$("#divId").css("display")}); – Mardoxx Sep 12 '14 at 11:04
  • 2
    "[hide it] after the page load again" I don't think this is possible, unless you, perhaps, persist some data in your browser's webstorage? – Mardoxx Sep 12 '14 at 11:07

1 Answers1

1

Do this:

<script>
    $(document).ready(function(){
        var x =$("#divId").css("display");

        alert(x);
    });
</script>
blalasaadri
  • 5,990
  • 5
  • 38
  • 58
Suchit kumar
  • 11,809
  • 3
  • 22
  • 44