Monday, September 9, 2013

compare href attribute on a table list javascript

compare href attribute on a table list javascript

Hmm Okay. Let's say we have this sample table.
<div id="linkedin">
<table id="linkedin_match">
<tr>
<th>Name</th>
<th>Company</th>
<th>Position</th>
</tr>
<tr class="match">
<td><a class="link"
href="http://www.linkedin.com/in/jannuelanarna">Jamuel
Christian</a></td>
<td>BDA Partnership</td>
<td>Inside Sales</td>
<td id="invite"><a href="#">Invite</a></td>
</tr>
<tr class="match">
<td><a class="link"
href="http://www.linkedin.com/in/jannuela">Jamuel
Christian</a></td>
<td>BDA Partnership</td>
<td>Inside Sales</td>
<td id="invite"><a href="#">Invite</a></td>
</tr>
</table>
</div>
I have this code that get the href of the a.link.
function getLink() {
var div = document.getElementsByClassName('link');
for (var i in div) {
console.log(div[i].href);
}
}
Also I have Javascript code that gets the current connection of the logged
user in linkedin.
function onLinkedInLoad() {
IN.Event.on(IN, "auth", onLinkedInAuth);
}
function onLinkedInAuth() {
IN.API.Connections("me")
.fields("firstName", "lastName", "industry" , "headline",
"publicProfileUrl")
.result(displayConnections);
}
function displayConnections(connections) {
var div = document.getElementById('connections');
var members = connections.values;
for(var member in members) {
console.log(members[member]);
}
}
What i want is to check if there is a user that is already on my
connections. Then if there is, i will remove it's href attribute. How
could I do this? any tips?

No comments:

Post a Comment