2016-09-12 6 views
-1

joomla virtuemartカスタムフィールドに€記号を追加しようとしています。 私はあなたがここに見るように解決策を見つけました: http://demo.magarantie.com/test.php 働いています。 だから私はあなたがここに見ることができるようjuery in virtuemartカスタムフィールド

vmJsApi::addJScript('euro'); 

を追加することにより、VMの詳細製品ページでこれを実装しようとしています: http://demo.magarantie.com/notre-offre/formule-solo/lavageを。 スクリプトはロードされていますが、 "prix d'achat"のカスタムフィールドにはmycustomid_31 IDがありません。 どのようにすればいいですか?

多くの感謝!

VirtueMartバージョン:3.0.17.4 | Joomla! 3.6.2

+0

あなたのコードをここにリンクするのではなく、ここに掲載することはできますか? – RamenChef

+0

あなたのコンソールでわかるように、エラーは$(window).load(function(){:$は関数ではありません。 – gaetanoM

答えて

0
$(window).load(function(){ 
(function($) { 
$.fn.setCursorPosition = function(pos) { 
if ($(this).get(0).setSelectionRange) { 
    $(this).get(0).setSelectionRange(pos, pos); 
} else if ($(this).get(0).createTextRange) { 
    var range = $(this).get(0).createTextRange(); 
    range.collapse(true); 
    range.moveEnd('character', pos); 
    range.moveStart('character', pos); 
    range.select(); 
} 
} 
}(jQuery)); 

$("#mycustomid_31 input").keyup(function(){ 
    if ($(this).val().split('').pop() !== '€') { 
     $(this).val($(this).val() + " €"); 
     $(this).setCursorPosition($(this).val().length - 2) 
    } 
}); 
});