The Power of Attributes
I found my new site (Medium!) for posting tech stuff after being on and off in the software development community and I read back some few articles I wrote from 2004! (http://jaredtech.blogspot.com/2004/12/software-developers-16th-century.html). Yes, software developers are like 16th century masons, they are craftsmen, 16th centuries masons became exceedingly wealthy sharpening their skills and building grand and high-quality structures throughout the span of their careers until they gain reputation beyond their skill sets and attracted the likes of non-artisan and non-craftsmen like politicians and high-ranking officers of the military whose purpose was to network and gain influence, well, so much for the mason thing. Basically being an artisan or craftsmen also applies to software developers.
What is an attribute? Probably one of the most overlooked feature of any mark-up language such as HTML or XML and it looks something like this:
<a href=”#”></a>In the above example, ‘href’ is an attribute. So what now? In any mark-up language attributes aren’t fixed sets of keywords, attributes can be defined in XML thru XSD or the XML Schema Definition. Any developer can define his own attributes even in HTML. One example is something like this:
<p my-attribute="id_of_another_element">You can change my value</p>
<button id="id_of_another_element">Submit</button>Suppose the HTML elements above were dynamically rendered multiple times creating a table, chart, a list or whatever and accessing an specific element, in this case a paragraph is tricky. One way to this is we can make a jquery call to the attr() method:
$("p").attr("my-attribute");
//returns the value of the attribute
let elementID = $("p").attr("my-attribute");
let targetID = "#" + elementID;
$(targetID).click(()=>{
console.log ("Clicked");});
Well, just making sense on of the example codes UI designers are sending me. Cheers!
