JPLery在TPL文件prestashop中

时间:2017-04-01 09:31:46

标签: jquery smarty3 prestashop-1.7

我想调用我的函数fullTxtFunc来显示我的所有文本块。我没有看到警报(fullTxt),我在firebug中也有错误: 我的文件Category.tpl:

{block name='product_list_header'} 
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
{literal}
$(document).ready(function(){

      function fullTxtFunc()
      {
        var fullTxt = {/literal}"{$category.description nofilter}";{literal}
        alert("fullTxt");
      }
     // $('.displayFullTxt').click(function(){

      //});

});
{/literal}

</script>
    <div class="block-category card card-block hidden-sm-down">
      <h1 class="h1">{$category.name}</h1>
      {if $category.description}
        <div id="category-description" class="text-muted">{$category.description|truncate:750:" ..." nofilter}<span class="fullTxt" onclick="fullTxtFunc();">Lire la suite</span></div>
        <div class="category-cover">
          <img src="{$category.image.large.url}" alt="{$category.image.legend}">
        </div>
      {/if}
    </div>
    <div class="text-xs-center hidden-md-up">
      <h1 class="h1">{$category.name}</h1>
    </div>
{/block} 

错误firebug: enter image description here 感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

尝试替换此代码:

map