Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have this line of javascript code inserted in a function...
..

select.options.add(new Option("Standard Floor Base (Base a pavimento Standard)", "SFB"));

..

With this other line of code I access the properties of the "select"....
..
select.classList.add("selectBlock");

..
In the .css...
..
.selectBlock{
  font-size: 12px;
  width: 290px;
  height: 20px;
  margin-left: 15px;
}

..

Through a file . css recall the "class" "selectBlock" and change some properties inserted in the "select"...
"Standard Floor Base (Base a pavimento Standard)"

..
I wish I could change only the first part of the text inserted in the "select", exactly this text..
"Standard Floor Base"

..
Is it possible ?... thanks for the help...

What I have tried:

Quote:
Hi, I have this line of javascript code inserted in a function...
..

select.options.add(new Option("Standard Floor Base (Base a pavimento Standard)", "SFB"));

..

With this other line of code I access the properties of the "select"....
..
select.classList.add("selectBlock");

..
In the .css...
..
.selectBlock{
  font-size: 12px;
  width: 290px;
  height: 20px;
  margin-left: 15px;
}

..

Through a file . css recall the "class" "selectBlock" and change some properties inserted in the "select"...
"Standard Floor Base (Base a pavimento Standard)"

..
I wish I could change only the first part of the text inserted in the "select", exactly this text..
"Standard Floor Base"

..
Is it possible ?... thanks for the help...
Posted
Updated 9-Feb-21 3:01am

1 solution

You already posted this question at Edit only a part of text inserted in a "select"... - JavaScript Discussion Boards[^]. Please do not crosspost.
 
Share this answer
 

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