0

Hi there I was looking into creating an award badge that my cliens can embedd into their sites so I can get a backlink. Obviously I want control of the anchor text so I decided it is easier and nicer to create a javascript widget. I followed these instructions here similar questions answered but I want to add css and text to my badge so am wondering how to do that within the code. Any help is appreciated thanks. Here is the code

var scriptTag, badge;
scriptTag = document.getElementById('badge');
badge = document.createElement('DIV');
badge.innerHTML = '<p>Wow, cool!</p>';
scriptTag.parentNode.replaceChild(badge, scriptTag);

I was looking to create something like tripadvisor but without too much code tripadvisor badge

Community
  • 1
  • 1
Jesse4113
  • 1
  • 3
  • HTML elements have "style" - is that what you mean by adding css, or did you want to add a CSS stylesheet? – Jaromanda X Feb 28 '17 at 00:49
  • Theoretically, if your clients load a JS file from your server, and can place a div with an id unique to you, you should be able to inject everything else you need into the page – haxxxton Feb 28 '17 at 00:50
  • I wanted to add css style sheet, how can I call the css with the javscript? – Jesse4113 Feb 28 '17 at 01:28

0 Answers0