I have this ejs file which is to be send as a response using res.render() in node.js
<!DOCTYPE html>
<html>
<head>
<title>pilcit</title>
</head>
<body>
<% var btn = document.getElementById('btn');%>
<% btn.style.background="blue"; %>
<div class="pt-5">
<div class="container-fluid">
<h1 style="color:blue;" align=center>Pilcit</h2>
<h4 style="color:#369bf4" align="center">The online clipboard</h4>
<div>
<textarea class="form-control mt-5" name="content" rows="12">
<%= result.content %>
</textarea>
<input type="text" value="sdfdsfsdfsd" id="foo">
<button id="btn" data-clipboard-target="#foo" copy clip </button>
</div>
<!--<input type="submit" value="Create Clip">-->
</div>
but the line
`<% var btn = document.getElementById('btn');%>
gives me this error
ReferenceError: /home/ubuntu/workspace/pilcit/views/show.ejs:34
32| </head>
33| <body>
>> 34| <% var btn = document.getElementById('btn');%>
35| <div class="pt-5">
36|
37| <div class="container-fluid">
document is not defined
at eval (eval at compile (/home/ubuntu/workspace/pilcit/node_modules/ejs/lib/ejs.js:618:12), <anonymous>:17:27)
at returnedFn (/home/ubuntu/workspace/pilcit/node_modules/ejs/lib/ejs.js:653:17)
at tryHandleCache (/home/ubuntu/workspace/pilcit/node_modules/ejs/lib/ejs.js:251:36)
at View.exports.renderFile [as engine] (/home/ubuntu/workspace/pilcit/node_modules/ejs/lib/ejs.js:482:10)
at View.render (/home/ubuntu/workspace/pilcit/node_modules/express/lib/view.js:135:8)
at tryRender (/home/ubuntu/workspace/pilcit/node_modules/express
I'm not using the <% var btn = document.getElementById('btn');%> to change the background color of the btn, I want to use it with clipboard js. I used that line to check whether the embedded javascript is working.
just been reading this: https://reactjs.org/docs/react-api.html#reactpurecomponent and trying to work out when would a function not return something pure? surely if you give a component the same ...
just been reading this: https://reactjs.org/docs/react-api.html#reactpurecomponent and trying to work out when would a function not return something pure? surely if you give a component the same ...
I need to redirect a page to another after 10seconds, and to do that, i'm using php header : header( "Refresh:10; url=http://myurl.local/test2.php", true, 303); But the problem is that when page ...
I need to redirect a page to another after 10seconds, and to do that, i'm using php header : header( "Refresh:10; url=http://myurl.local/test2.php", true, 303); But the problem is that when page ...
I have full Date in my JSON Array,but as of my needs i only want the date not the month and year like if full date is 2018-12-01 i want to have only 01. As this is the requirement for me and i have ...
I have full Date in my JSON Array,but as of my needs i only want the date not the month and year like if full date is 2018-12-01 i want to have only 01. As this is the requirement for me and i have ...
How to get output HTML and CSS of grapes.js in Javascript ? I am writing a Django app for newsletter, in which I need a newsletter editor for which I used "grapes.js" newsletter. Everything is fine ...
How to get output HTML and CSS of grapes.js in Javascript ? I am writing a Django app for newsletter, in which I need a newsletter editor for which I used "grapes.js" newsletter. Everything is fine ...