-1
I would need the function below in .asp. I have no notion of language, someone can help?
Fiz em Javascript, segue:
function limparClasse(classe) {
var elementos = document.querySelectorAll('.' + classe);
for (var i = 0; i < elementos.length; i++)
elementos[i].innerHTML = elementos[i].innerHTML.replace(/,.*%/, "%");
}
limparClasse('vtex-cpShow');
<span class="desconto-de vtex-cpSave vtex-cpShow ">36,00 % OFF</span>
in Asp is used the control $product.Listpriceminusbestpriceinpercent OFF
– lucas inverso
Are you using a Textbox? How are you assigning this information?
– Laerte
The value comes 30.0 % OFF is generated by the system
– lucas inverso
Which system? Are you using any framework? I’m trying to understand the context. Can you provide more details? Your question is too vague.
– Laerte
Is it ASP or ASP.NET? The problem is ASP-related or is it just Javascript?
– Maniero
It is a cms(vtex platform), the $product.Listpriceminusbestpriceinpercent would be a control. This control generates the percentage within the <span> with two decimal places, it would need to round.
– lucas inverso
bigown would be ASP.NET. The problem is actually with javascript, I’m using an Infinite scroll(plugin) of products but I can’t include the function I mentioned when new products are loaded. That’s why I’m trying to round off directly from Asp.net, if possible.
– lucas inverso
Where does the information come from? Complete code is required, or if only the way to replace one string with another was provided, it would help?
– carlosrafaelgn
Guys, thanks for the help, I was able to solve by incredible as it may seem by CSS(rs) width and overflow:Hidden.
– lucas inverso
@lucasinverso actually like this you solved on your screen and in your browser. this solution of hiding piece of string will give problem, depending on the size of the digits, the browser involved and a number of other factors. Tip: click "edit" below the question, explain the result you want, with examples (not just code), so we can vote to reopen the question, and someone can give a real answer.
– Bacco