Jump to content

Passing var to jquery in a tpl?


Recommended Posts

I have added this jquery to my CMS.tpl

script type="text/javascript">

    $(document).ready(function (){

        $(".my_answer").hide();
        $(".list-group-item").show();

    });
function LoadPage(my_link){
    alert('Hello');
    $("#answer").slideToggle();
    $('#answer').load("my_link .rte");
}
</script>

i am trying to pass the var $my_link  from a button ,because in each iteration it has different link,

{foreach from=$cms_pages item=cmspages}
<li>
{$my_link=$link->getCMSLink($cmspages.id_cms, $cmspages.link_rewrite)|escape:'html':'UTF-8'}
<a  id="my_button" onclick="Tests({$my_link});"  class="list-group-item" href="#" title="{$cmspages.meta_title|escape:'html':'UTF-8'}" >{$cmspages.meta_title|escape:'html':'UTF-8'}  </a>

<div id="answer" class="my_answer"  ></div>

</li>
{/foreach}

but it doesnt work ,any body has an idea ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...