Währung Prefix
Guten morgen zusammen, ich habe mit viel rumpröbeln meine erstes Berechnungsscript mit Schieberegler hinbekommen.
Leider hapert es nun noch an der Formatierung der Preisausgabe.
Das ende der Berechnung & Ausgabe
Format. Funktion
Das funktioniert soweit.
Wie kriege ich es hin das vor der Preisausgabe "CHF" steht?
Leider hapert es nun noch an der Formatierung der Preisausgabe.
Das ende der Berechnung & Ausgabe
behandlungspreis = waerungsformat(zwischentotal);
//preis ausgeben
jQuery("input.behandlungspreis").val(behandlungspreis);
Format. Funktion
function waerungsformat (num) {
return num
.toFixed(0) // always two decimal digits
.replace(".", ",") // replace decimal point character with ,
.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1.") + ".-" // use . as a separator
}
Das funktioniert soweit.
Wie kriege ich es hin das vor der Preisausgabe "CHF" steht?
Please also mark the comments that contributed to the solution of the article
Content-Key: 556052
Url: https://administrator.de/contentid/556052
Printed on: April 25, 2024 at 17:04 o'clock
2 Comments
Latest comment
Wie kriege ich es hin das vor der Preisausgabe "CHF" steht?
Zu viel Toblerone gefuttert...?!Entweder so direkt im Code
behandlungspreis = "CHF" + waerungsformat(zwischentotal);
jQuery("input.behandlungspreis").val(behandlungspreis);
function waerungsformat (num) {
return 'CHF' + num
.toFixed(0) // always two decimal digits
.replace(".", ",") // replace decimal point character with ,
.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1.") + ".-" // use . as a separator
}
p.s. Copy n Paste Tag ist Freitag.