How to get the value of an attribute in Javascript

Node values and Element Attributes are different parts of an html tag. So, you have to use element.value instead. This is a an example, to show you how you can fetch value, data, attribute from an input field. The HTML input field. <input type=”text” id=”profile” data-nationality=”Eritrean” value=”Simon”> and the javascript. var el = document.getElementById(“profile”); console.log(el.value) … Read more

Understanding the difference between __getattr__ and __getattribute__

Some basics first. With objects, you need to deal with their attributes. Ordinarily, we do instance.attribute. Sometimes we need more control (when we do not know the name of the attribute in advance). For example, instance.attribute would become getattr(instance, attribute_name). Using this model, we can get the attribute by supplying the attribute_name as a string. … Read more