According to previous question Previous question
I have this button And i want you to help me to click it with javascript code. Here is the class of the button.
Before click
<a class="UFILikeLink" href="#" role="button" aria-label="Like this" aria-live="polite" data-ft="{"tn":">"}" data-reactid=".19l">
<i class="UFILikeLinkIcon img sp_nbjSKc2Bl8j sx_49c162" data-reactid=".19l.0"></i>
<span data-reactid=".19l.1">Like</span></a>
After click
<a class="UFILikeLink UFILinkBright" href="#" role="button" aria-label="Unlike this" aria-live="polite" data-ft="{"tn":">"}" data-reactid=".19l">
<i class="UFILikeLinkIcon img sp_nbjSKc2Bl8j sx_df3f80" data-reactid=".19l.0">
</i><span data-reactid=".19l.1">Like</span></a>
@dikkini made up a solution with this code
var el = document.getElementsByClassName('UFILikeLink');
for (var i=0; i<el.length; i++) {
var ele = el[i];
if (!hasClass(ele, "UFILinkBright")) {
ele.click();
}
}
function hasClass(element, cls) {
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
}
BUT now i have one extra button with the same CLASS but different Title. And when i execute 2 times the javascript code, the 2nd button is also pushed. But i dont want it to be pushed at all. No matter how many times i execute the code that dikkini suggested.
The code of this button is this..
<a class="UFILikeLink" data-ft="{"tn":">"}" href="#" role="button" title="Like this comment" data-reactid=".1h.1:4:1:$comment535881486576364_535889293242250/=10.0.$right.0.$left.0.3.$likeToggle/=10">Like</a>
As you can see it has a Title. Can someone help me make an if statement so if it has this title NOT to push it? Thanks a lot!