Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm tryingto send or post the checkbox element below to express that act as the backend of my app, in my case from the app.js to index.js(express).


APP.JS file
const checkbox = document.createElement("checkbox");


checkbox.innerHTML = `
       <label class="checkbox" for="myCheckboxId">
         <input class="checkbox__input" type="checkbox" name="myCheckboxName" id="myCheckboxId">
         <div class="checkbox__box"></div>
       </label>
       `;


The visualization in the browser is good but then I need to do some manipulation in index.js express file so that I can add this element into a column table (that it is filled in express file). The value of a checkbox variable in index.js file should be the same element of that in app.js file. I understand that in node/express it is not possible to use the "document." element. So how can I reach my objective?

What I have tried:

Tried to use fetch API but got only undefined values (maybe using that wrong)
Tried to check jsdom or other similar tools but these were not useful for my objectve.
Posted
Comments

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900