可编辑链接.帮助 [英] Jeditable to edit a link. Help

查看:74
本文介绍了可编辑链接.帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经和jeditable玩了两天了,真是太好了!

I have been playing around with jeditable for 2 days now, and it's great!

但是我有一个小问题,我有一个应该可编辑的链接,但是无论何时该字段变为可编辑的,我都无法编辑该字段,当我单击时,它会跳到该链接.

But I got a little problem, I have a link which should be editable, but whenever the field become editable, I can't edit that field, when I click, it jumps right to that link.

有解决方案吗?

这是我的代码

<a href="$homeurl/$hashkey" class="editsubject" id="$hashkey">$subject</a><span class="edittrigger" style="cursor:pointer;background:#EEEEEE;">edit</span>


$(document).ready(function() {
             $('.editsubject').editable('editsubject.php', {  
                    event : 'editclick',
                    cancel : 'Cancel',
                    submit : 'OK',
                    indicator : 'Wait...',
                    id : 'hk',
                    name : 'ns',
                    css : 'inherit'
             });
            $('.edittrigger').bind('click', function() {
                $(this).prev().trigger('editclick');
            });
         });

谢谢

推荐答案

jEditable问题,这是一种解决方法

jEditable problem, here's a workaround

我将使用隐藏范围,然后在提交时替换链接的文本,然后单击触发器,使链接不可见并显示隐藏范围

I would use a hidden span and then have it replace the text of the link on submit, and when you click on the trigger, make the link invisible and show the hidden span

<script type='text/javascript'>
$(document).ready(function() {
    $('.proxyedit').editable('editsubject.php', {  
        event : 'editclick',
        cancel : 'Cancel',
        submit : 'OK',
        indicator : 'Wait...',
        id : 'hk',
        name : 'ns',
        css : 'inherit',
        callback : function(value, settings) {
            $(this).css({'display':'none'});
            $('.editsubject').text($(this).text()).css({'display':'inline'});
        }

    });
    $('.edittrigger').bind('click', function() {
        $(this).prev().trigger('editclick');
        $('.proxyedit').css({'display':'inline'});
        $('.editsubject').css({'display':'none'});
    });
});
</script>

在体内

<a href="$homeurl/$hashkey" class="editsubject" id="$hashkey">$subject</a><span style="display:none;" class="proxyedit">$subject</span><span class="edittrigger" style="cursor:pointer;background:#EEEEEE;">edit</span>

这篇关于可编辑链接.帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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