聪明的tpl中的jquery [英] jquery in smarty tpl

查看:61
本文介绍了聪明的tpl中的jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

smarty tpl中的jquery - 尝试使用jquery插入一个类属性,以便我可以使用着色为每个其他列表项行设置CSS样式。以下代码似乎应该可以工作,但alt类没有插入到li标签中。页面加载很好 - 没有问题。有人看到明显错误的东西吗?

jquery in smarty tpl -- Trying to use jquery to insert a class attribute so that I can CSS style every other list item row with shading. The following code seems as though it should work, but "alt" class is not getting inserted into li tag. Page loads fine -- no problems there. Anyone see something obviously wrong?

{literal}
<script src="{$content_dir}themes/pres2c/js/stripe/jquery-1.7.1.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function(){
        jQuery(".block_content li:even").addClass("alt");
        });
    </script>
{/literal}

这个最终的网页来源就像这样出现在head,但仍然没有触及li标签..

this final webpage source is appearing, just like this, in the head, but still li tags aren't getting touched..

<script src="{$content_dir}themes/pres2c/js/stripe/jquery-1.7.1.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function(){
        jQuery(".block_content li:even").addClass("alt");
        });
    </script>


推荐答案

尝试:

{literal}
<script src="{/literal}{$content_dir}{literal}themes/pres2c/js/stripe/jquery-1.7.1.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function(){
        jQuery(".block_content li:even").addClass("alt");
        });
    </script>
{/literal}

这篇关于聪明的tpl中的jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆