javascript - Adding search box to React / JSX (using script tag) -
how can add following html react/jsx in render function?
<a name="cjsearchboxanchor"></a> <div class="cjsearchbox"> <script language="javascript" type="text/javascript" src="http://www.careerjet.de/partners/js_searchbox.html?n=7&nfr=1"></script> <div class="cjbotl bloggerdiv"></div> </div>
what have tried:
a) using following code, entering ordinary (empty) 'script' tag in jsx:
componentwillmount() { const script = document.createelement("script") script.src = "http://www.careerjet.de/partners/js_jobbox.html s=java&l=schweiz&n=5&lid=38241&nfr=1&ntt=1"; script.language = "javascript"; script.type= "text/javascript"; script.async = true; document.body.appendchild(script); }
b) appending 'embedcode' string containing entire html above jsx using jquery following command: $('.classnameofmydiv').append(embedcode);
- following script tag in react - codepad example
=> search box appear, not possible interact it. because of following issue:
"'document': isn't possible write document asynchronously-loaded external script unless explicitly opened."
c) npm install --save postscribe
- following krux/postscribe
d) adding html above span
tag dangerouslysetinnerhtml={{__html: ...}}
is there easy way fix this, or else 1 can search box working react? inputs appreciated.
Comments
Post a Comment