1
The idea is this.. when I call a function that brings values from a string
included in the script I want the word(s) (s) to begin as an example:
- & Neutral Colors
If highlight of the others, suppose some simple phrases, such as:
Cores do Arco-Íris
Cores sortidas
Diversas cores e sabores
Sem cor, apenas Neutro
Preto-e-Branco, neutro
Sabão neutro
Well, these lines should stay on "bold" already containing the words & Neutral Colors.
I’ve been betting my record on this routine:
var negrito = "cores";
var indexar = string.indexOf(negrito);
if (indexar != -1) {
// se for diferente de -1 é que a palavra foi localizada então faça uma ação
..style.fontWeight='bold';
}
It will depend on how this separate your line in the gift.
– Wictor Chaves
Because you have to know where the phrase limit is, if a phrase is bounded by a tag p for example, just put this property in the tag p, but if the separation is by an n you will have to separate this phrase, that’s what I’m trying to say.
– Wictor Chaves
But the phrases are in a tag p in html, or variables in script?
– LeAndrade
@Leandro In the HTML document without the tag
p
, it comes from the script when I click the button. It is not involved between delimiters<p>..</p>
That is why I want to invest in the above routine, because you should look for the word after being brought forward, already on the page. Hence apply the formatting.– Diego Henrique
Formatting only the found word would be much simpler. The whole line is complicated, unless there is some non-visual mark from where it is the beginning and end of each line.
– bfavaretto
Take a look at this answer here on the site, I think it serves as a basis: https://answall.com/a/48604
– bfavaretto