How use a third part js script

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
onoboa
User
Posts: 80
Location: Guayaquil - Ecuador

How use a third part js script

Post by onoboa »

Grettings,

I need to show a numeric fields with decimal point and thousand separator, I try to use a cleave.js but when I execute the page shows me an error press F12.

Error: .cleave( is not a function

This is my code:

Server Events->Global->All Pages->Page_Head

AddClientScript("jquery/cleave.js");
AddClientScript("jquery/cleave.min.js");

Client Scripts->Global->List Page->Startup Script

$('#x_cantidad,#x_costo,#x_precio,x_subtotal,#x_porc_descuento,#x_descuento,#x_baseimponible,#x_porc_iva,#x_impuesto,#x_total').cleave({ numeral: true, numeralThousandsGroupStyle: 'thousand', autoUnmask: true});

Some one example to use a js library.

Thanks,

Omar


arbei
User
Posts: 9286

Post by arbei »

Note that JavaScripts are loaded asynchronously. If your scripts depends on jQuery, you need to load them after jQuery is loaded. You may read example 5 under Page_Head, e.g.

<script>
loadjs.ready("jquery", function () {
    loadjs("/my/base/path/path/jquery/cleave.js"]); // Replace "my/base/path" with your real base path
});
</script>

Post Reply