Explore the community Forums Lectora Lectora Questions & Answers Formatting in-line variables Reply To: Formatting in-line variables

#431346 Score: 0
Profile photo of Lydia B
Lydia B
Member
beginner
intermediate
curious george
wise owl
friend finder
contributor
@lb1730

@mnotermans

I really appreciate you taking the time to respond.

I have search and tried, but I am afraid that my lack of knowledge is preventing me from getting it to work.

I followed the instructions on the post mentioned by Carl and got the field to be right justified and used your code to add the commas as thousand separators, but the code changed the way the entry field looks. It took out all my other changes to the field and upon input it seems as it took the field back to default.

Is it possible to alter your code to target specific field?

Your code:

<style>
input{
text-align:right;
}
</style>

The above code justifies all the fields. I need to target the specific one.

You also used this code to add commas as thousand separators:

var theentry = document.getElementById(“%HTMLNAME%id”).value.replace(/,/g, ”);
document.getElementById(“%HTMLNAME%id”).value = parseFloat(theentry).toLocaleString(‘en’);
VarEntry_0001.set(document.getElementById(“%HTMLNAME%id”).value);

Thank you again for that code! It works amazing and it is easy to use. Is there a way to add decimal places? I tried the currency, but it adds a dollar sign, which I do not want. I tried to add the minimum and maximumFractionDigits, but it disallowed number larger than one integer.

If you are able to, I would appreciate any help you may offer. Thank you for responding either way Math.