jquery attr () cannot get property value issues
The CSS has already been set up:
Can still not get:
Guidance.
It must be that undefined,attr is used to get or set the Tag property, not to get the CSS property. If you have a tag with an ID of nn1, you can use ww=$ ("#nn1"). CSS ("top") to get CSS properties.
How tag properties differ from CSS properties
Chase Answer<script type= "Text/javascript" >
$ (document). Ready (function () {
Alert ($ ("#nn1"). attr ("title")); The title in the div tag is the tag attribute, and the ID is the tag attribute, which is the attribute that appears in the tag;
Alert ($ ("#nn1"). CSS ("top")); CSS properties are properties in the style sheet;
});
</script>
<style type= "Text/css" >
#nn1 {
position:relative;
top:30px;
}
</style>
<div id= "nn1" title= "This is a div" >abc</div>
JQuery Gets the tag attribute value problem