How can I format my number with this jquery library?

Hello guys,

I downloaded this library and I need to format my value this way: 1.963,35

How can I do this with this library, I didn't find any example with it for that

http://digitalbush.com/projects/masked-input-plugin/


thanks
LVL 1
hidrauAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
Use :


$(document).ready(function() {
		$(".num").mask("999.999,99");
	});

Open in new window

0
 
leakim971PluritechnicianCommented:
test page :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script language="javascript" src="http://jquery-joshbush.googlecode.com/files/jquery.maskedinput-1.2.2.min.js"></script>
<script language="javascript">
	$(document).ready(function() {
		$(".num").mask("999.999,99");
	});
</script>
</head>
<body>
<input type="text" class="num" /><br />
<input type="text" class="num" /><br />
<input type="text" /><br />
<input type="text" /><br />
</body>
</html>

Open in new window

0
 
hidrauAuthor Commented:
Yeah, it worked very fine, but I noticed that I have a big problem and I don't know why.

When I open my page, I have some fields with values, I run my asp query that return values and I pass the values to variables that is displayed in input, this way:

<input name="Faliqicms"     type="text" class="Campos numero" id="Faliqicms"     value="<%=AliqIcms%>"  />

Using the mask, the values is not being displayed, do you know why?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
leakim971PluritechnicianCommented:
The plugin don't work in that way. It's to check inputs from user not from server side or at page loading.
Try, if possible, to format the number before set it as value
0
 
hidrauAuthor Commented:
Yeah,

I formated the number this way:

AliqIcms =  FormatNumber(Rs("RecNf_TotalNF"))      

but nothing is displaying in the field
0
 
leakim971PluritechnicianCommented:
sorry for this question but without the class do you get something ? I think you miss something server side. I should work.
 
0
 
leakim971PluritechnicianCommented:
I can confirm you the plugin format number at pageload too
0
 
hidrauAuthor Commented:
Take a look at my page.


page.txt
0
 
leakim971PluritechnicianCommented:
For example, try to replace something like :
< input name="Fnfe" type="text" class="Campos" id="Fnfe" value="<%=Nfe%>" / >

With :
< input name="Fnfe" type="text" class="Campos" id="Fnfe" value="12345.67" / >

0
 
hidrauAuthor Commented:
I will try
0
 
hidrauAuthor Commented:
Leak, I tried it and nothing :((

very strange, it works with you?
0
 
leakim971PluritechnicianCommented:
Yes Sir! And at page load! Do you have a live link to test it ?
0
 
hidrauAuthor Commented:
well, I will make some test in a clean page and I will let you know.

Thanks for keeping up with me on this thread.

0
 
leakim971PluritechnicianCommented:
np
0
 
hidrauAuthor Commented:
Leak, I didn't have a good success with it.

But a friend of mine told me to use this library

http://plugins.jquery.com/project/maskinputmoney

take a look at
0
 
leakim971PluritechnicianCommented:
I check again your page.txt, I did'nt see where you include the jquery and the masked input jquery pluginS
0
 
hidrauAuthor Commented:
leak, I got it with that library.

I thank you for your support so far
0
 
leakim971PluritechnicianCommented:
You're very welcome! See you later! Thanks for the points!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.