1 | <script type = "text/javascript" src = "../../public/static/js/jquery.js"></script> |
---|
2 | Has attribute, in DOM: <span id = "eg1">changeme</span><br /> |
---|
3 | Has attribute, not in DOM: <span id = "eg2">changeme</span><br /> |
---|
4 | Doesn't have attribute, in DOM: <span id = "eg3">changeme</span><br /> |
---|
5 | Doesn't have attribute, not in DOM: <span id = "eg4">changeme</span><br /> |
---|
6 | <div id = "inDOM" style = "display: none"></div> |
---|
7 | <script type = "text/javascript"> |
---|
8 | $(document).ready(function() { |
---|
9 | var newDiv = $('<div style = "display: none"></div>'); |
---|
10 | $('#eg1').text($('#inDOM').css('display')); |
---|
11 | $('#eg2').text(newDiv.css('display')); |
---|
12 | $('#eg3').text($('#inDOM').css('margin') || 'changed'); |
---|
13 | $('#eg4').text(newDiv.css('margin') || 'changed'); |
---|
14 | alert('Done'); |
---|
15 | }); |
---|
16 | </script> |
---|