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

206
Views
Why the css font-weight property is not working in my case?

My selected_cell just contains a paragraph as its child with a default normal class applied.

My css code:

.normal{
    font-weight: normal;
}.bold{
    font-weight: bolder;
}

My JS Code:

function bold()
{
  var selectedcell=document.querySelector('.selected-cell');
  
  if(selectedcell.children[0].class=="normal")
  {
  selectedcell.children[0].class="bold";console.log(selectedcell.children[0])}
  else
  {
  selectedcell.children[0].class="normal";console.log(selectedcell.children[0])};
}

Here I have created a function bold wherein I make the text of the selected cell look bolder using the font-weight property.But apparently it doesnt work.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try this

function bold()
{
  let selectedcell = document.querySelector('.selected-cell');
  
  if(selectedcell.children[0].classList.contains("normal"))
  {
  selectedcell.children[0].classList.replace("normal","bold");
  }
  else
  {
  selectedcell.children[0].classList.add("normal");
  };
}
about 4 years ago · Juan Pablo Isaza 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!