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

197
Views
Making variable text bold
  var text1 = "Mind";
  var text2 = document.getElementById("t1").value;
  var text3 = text1.concat(text2);
  document.getElementById("t2").innerHTML = text3;

I want to make the text of variable "text2" in bold when displayed, Please tell how I can do that...

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

0

text2.style.fontWeight = 'bold';

about 4 years ago · Juan Pablo Isaza Report

0

Here you do not need any css. Bold function Create a tag .

var text1 = "Mind";
var text2 = document.getElementById("t1").value.bold();
var text3 = text1.concat(text2);
document.getElementById("t2").innerHTML = text3;

Or You can do this

var text1 = "Mind";
var text2 = document.getElementById("t1").value;
document.getElementById("t1").style.fontWeight = "900";
var text3 = text1.concat(text2);
document.getElementById("t2").innerHTML = text3;
about 4 years ago · Juan Pablo Isaza Report

0

In two ways

1.add its style like this:

text2.style.fontWeight = 'bold';
  1. you can do it setting the innerHTML property of the element, just like this:

     text2.innerHTML = "<b>Hello</b>";
    
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!