Each attribute of each element is accessible through the attr() function. If you can do document.getElementById() on this element and then access the property, you can also do this with the attr() function. However, when using jquery, some properties are more easily accessible in other ways. For example, to see if an element is hidden or invisible, you can do:
var isVisible=$("#el").is(":visible");
instead of using the attr() method. Similarly, you can find selectedIndex drop-down lists and the text of the selected parameter is easier than using the attr() method. This pdf describes some of these simpler approaches.
To access the css property, you better do:
var fontWeight=$("#el").css("fontWeight");
instead of using get() or attr() . You can also set css properties this way, for example:
$("#el").css("fontWeight","bold");
source share