How can I add a <link>
node into the <head>
section of a page using jquery? And if the element already exists, it should not be added twice.
I need to add this CSS file because it pulls in additional styling for my search function. This jquery highlighter requires the .highlight
class be added to the page, so highlights look yellow.
Edit: I could do this, but it does not check if the element has already been added.
$('head').append('<link rel="stylesheet" href="style2.css" type="text/css" />');