admin管理员组文章数量:1426094
I already know how to get a value from a label, the problem is that its showing something like
€123,453.28
I need to remove the eurosign and the mas to be able to make a calculation.
Not remove the decimal point of course
$(document).ready(function () {
$("#TxtVatExcluded").keypress(function () {
var invoicedAmmount = $("#MainContent_VehicleInformationControl_LblInvoicePriceValue").text();
alert(invoicedAmmount);
if (invoicedAmmount > 0) {
var ammountWithoutVat = $("#TxtVatExcluded").val();
var result = (ammountWithoutVat / invoicedAmmount) * 100;
$("#OutputLabel").html(result + " %");
}
});
});
I already know how to get a value from a label, the problem is that its showing something like
€123,453.28
I need to remove the eurosign and the mas to be able to make a calculation.
Not remove the decimal point of course
$(document).ready(function () {
$("#TxtVatExcluded").keypress(function () {
var invoicedAmmount = $("#MainContent_VehicleInformationControl_LblInvoicePriceValue").text();
alert(invoicedAmmount);
if (invoicedAmmount > 0) {
var ammountWithoutVat = $("#TxtVatExcluded").val();
var result = (ammountWithoutVat / invoicedAmmount) * 100;
$("#OutputLabel").html(result + " %");
}
});
});
Share
Improve this question
edited May 16, 2012 at 12:59
gdoron
150k59 gold badges302 silver badges371 bronze badges
asked May 16, 2012 at 12:02
Luis ValenciaLuis Valencia
34.1k99 gold badges311 silver badges532 bronze badges
1
- What was the value, and what do you want the output to be? – gdoron Commented May 16, 2012 at 12:13
1 Answer
Reset to default 6"€123,453.28".replace(/[^\d.]/g,"") // Replace every non digit char or dot char
// With an empty string.
Live DEMO
So in your code:
var ammountWithoutVat = $("#TxtVatExcluded").val().replace(/[^\d.]/g,"");
var result = (pareseFloat(ammountWithoutVat, 10) / invoicedAmmount) * 100;
本文标签: javascriptRemove Euro Value and money format with JQueryStack Overflow
版权声明:本文标题:javascript - Remove Euro Value and money format with JQuery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745468414a2659635.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论