user156144
user156144

Reputation: 2295

Crossrider: change title of a link

Using crossrider, is it possible to get link object in a dom and change the link's title. I am creating a plugin that detect malicious site and add [Malicious] in front of the link.

I probably could do this by parsing strings, but if it is supported by DOM, it would make my life so much easier.

Upvotes: 0

Views: 151

Answers (1)

Shlomo
Shlomo

Reputation: 3753

Crossrider extensions support the jQuery ($) object and hence you can use it to obtain your link from within the extension.js file, as follows:

appAPI.ready(function ($) {
    // Where <linkSel> is the selector for retrieving the link or links you require
    $(<linkSel>).text(); // retrieves the text for the specified <linkSel> object

    // OR the following to prefix the link's text with '[Malicious] '
    $(<linkSel>).text('[Malicious] ' + $(<linkSel>).text());
});

Upvotes: 4

Related Questions