Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
How do I add a checkbox on the same line as my paragraph?

I am trying to add a check box on the same line as my paragraph in my to do list.

I have tried:

let addToDoButtton = document.getElementById('addToDo');
let toDoContainer  = document.getElementById('toDoContainer');
let inputField = document.getElementById('inputField');

addToDoButtton.addEventListener('click', function(){
var  paragraph = document.createElement('p');
var  checkbox  = document.createElement('input');
checkbox.type='checkbox';



paragraph.classList.add('paragraph-styling');
paragraph.innerText = inputField.value;

toDoContainer.appendChild(checkbox);
toDoContainer.appendChild(paragraph);

inputField.value=""
paragraph.addEventListener('click', function () {
    paragraph.style.textDecoration="line-through";
    paragraph.style.color='#5493f7';
    
})
paragraph.addEventListener('dblclick', function(){
    toDoContainer.removeChild(paragraph);
    toDoContainer.removeChild(paragraph)


})

I have also tried:

toDoContainer.appendChild(checkbox) && 
toDoContainer.appendChild(paragraph);

I got this for the output:

output

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Please take a look here

const input = document.createElement('input');
input.id = 'input';
input.type = 'checkbox';

const label = document.createElement('label');
label.htmlFor = 'input';

toDoContainer.append(input, label);
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!