Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jQuery&x27在Joomla中定义/获取语言;行不通_Jquery_Joomla_Jquery Plugins_Joomla2.5_Joomla3.0 - Fatal编程技术网

使用jQuery&x27在Joomla中定义/获取语言;行不通

使用jQuery&x27在Joomla中定义/获取语言;行不通,jquery,joomla,jquery-plugins,joomla2.5,joomla3.0,Jquery,Joomla,Jquery Plugins,Joomla2.5,Joomla3.0,我有一个文本(1,00欧元),我想根据实际语言用另一个文本替换。。。但不幸的是,我无法使用以下代码从url获取正确的值,或者出现了问题: if ((location.href.indexOf('/en/') > -1){ $('.price').each(function() { var text = $(this).text(); $(this).text(text.replace('1,00 EUR', 'Price upon request'));

我有一个文本(1,00欧元),我想根据实际语言用另一个文本替换。。。但不幸的是,我无法使用以下代码从url获取正确的值,或者出现了问题:

if ((location.href.indexOf('/en/') > -1){
    $('.price').each(function() {
    var text = $(this).text();
    $(this).text(text.replace('1,00 EUR', 'Price upon request')); 
    });
}

if (location.href.indexOf('/de/') > -1) {
    $('.price').each(function() {
    var text = $(this).text();
    $(this).text(text.replace('1,00 EUR', 'Preis auf Anfrage')); 
    });
}

if (location.href.indexOf('/fr/') > -1) {
    $('.price').each(function() {
    var text = $(this).text();
    $(this).text(text.replace('1,00 EUR', 'Prix sur demande')); 
});
}
类是price,url用于获取语言


谢谢

代码是否在
文档中运行。是否准备好了
块,以便在代码运行时存在元素?您是否尝试在该代码中登录到控制台以确保它正在运行?页面中出现任何错误?是的,它正在“document.ready”中运行,并且它在没有“if语句”的情况下工作,
if
似乎是正确的…请尝试从控制台上运行此代码,如果不访问pageis代码在
文档中运行,仍然无法提供更多帮助。ready
阻止代码运行时元素是否存在?您是否尝试在该代码中登录到控制台以确保它正在运行?页面中出现任何错误?是的,它正在“document.ready”中运行,并且它在没有“if语句”的情况下工作,
if
似乎是正确的…尝试从控制台运行此代码,在没有访问页面的情况下仍然无法提供更多帮助