调用jquery替换内容在函数内部时不起作用

时间:2013-05-14 05:01:17

标签: jquery draggable droppable

所以我试图:http://jsfiddle.net/LdeGC/1/

            if ($('.ui-droppable').find('span.closer').length == $('.ui-droppable').length) {
                alert('Listo ahora puedes simularlo');
                //if target is filled
                    $(".status1").replaceWith('<i class="icon-check"></i> Listo ahora puedes simularlo'); //update status
                //put composition into params
            } else {
                $(".status1").replaceWith('<i class="icon-edit"></i> Sigue');
            }

警报有效,但是if内部的jquery replaceWith没有,我该如何解决呢?

1 个答案:

答案 0 :(得分:1)

尝试使用html代替replaceWith

尝试下面

 if ($('.ui-droppable').find('span.closer').length == $('.ui-droppable').length) {
            alert('Listo ahora puedes simularlo');
            //if target is filled
                $(".status1").html('<i class="icon-check"></i> Listo ahora puedes simularlo'); //update status
            //put composition into params
        } else {
            $(".status1").html('<i class="icon-edit"></i> Sigue');
        }