jquery append不适用于CakePHP的JsHelper

时间:2012-07-07 09:01:44

标签: jquery cakephp formhelper

我想使用cakephp form helper动态附加一些表单元素。

我缺少什么?

<script type="text/javascript">
        $("a#megyeAdd").click(function(){
            $("div#moreCounty").append(
                <?php echo $this->Form->input('ColleaguesCounty.1.county_id',array('label' => 'Megye')); ?>
            );
        });     
</script>

1 个答案:

答案 0 :(得分:0)

您在.append参数上缺少引号。

$("div#moreCounty").append("<?php echo $this->Form->input('ColleaguesCounty.1.county_id',array('label' => 'Megye')); ?>");