I need to make a function that replaces: addthis:url= addthis:title= and addthis:description= in these 3 elements:
<a class="addthis_button_facebook_like" fb:like:layout="button_count"
addthis:url="http://example.com"
addthis:title="An Example Title"
addthis:description="An Example Description"></a>
<a class="addthis_button_tweet"
addthis:url="http://example.com"
addthis:title="An Example Title"
addthis:description="An Example Description"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"
addthis:url="http://example.com"
addthis:title="An Example Title"
addthis:description="An Example Description"
></a>
How do I do it? E.g: with the values newurl.com, newtitle and newdescription?
If you give your elements an ID for easy access you can do something like this:
I’ll leave it to you to encapsulate that in a function as required.
Note: if you don’t want to or can’t give your elements an ID for some reason you could try
document.getElementsByClassName()on your existing HTML, but IE didn’t introduce support until IE9.