我无法输入文字 [英] I can't type to inputs

查看:68
本文介绍了我无法输入文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以排序的列表.我正在将jQuery UI与小部件,鼠标,位置,可排序的插件结合使用.

I have a list which can be sortable. I'm using jQuery UI with widget, mouse, position, sortable addons.

CSS:

#sortable{
    width : 550px;
    display: inline-block;
}
#sortable li, #add {
    width : 550px;
    margin : 5px;
    padding : 5px;
    height : 50px;
}
#sortable li img.social-icon, #sortable li img.drag-cursor {
    width: 40px;
    height : 40px;
    float : left;
}
#sortable li img.social-icon {
    margin-right : 5px;
}
#sortable li img.drag-cursor {
    margin-left : 5px;
    cursor : move;
}
#sortable li input {
    height:40px;
    width:450px;
    line-height: 45px;
    float:left;
}
#add {
    cursor : pointer;
    text-align: center;
    line-height: 45px;
}
.ui-state-highlight { height: 50px; line-height: 50px; }

HTML:

<div id="dash-wrapper">
    <ul id="sortable">
        <li class="ui-state-default">
            <img src="images/social/twitter.png" class="social-icon" />
            <input type="text" value="textt" name="user-media-link[]" class="user-media-link">
            <input type="hidden" name="social-media-type" value="1">
            <img src="images/drag.png" class="drag-cursor">
        </li>
        <li class="ui-state-default">
            <img src="images/social/facebook.png" class="social-icon" />
            <input type="text" value="textt" name="user-media-link[]">
            <input type="hidden" name="social-media-type" value="1">
            <img src="images/drag.png" class="drag-cursor">
        </li>
        <li class="ui-state-default">
            <img src="images/social/rss.png" class="social-icon" />
            <input type="text" value="textt" name="user-media-link[]">
            <input type="hidden" name="social-media-type" value="1">
            <img src="images/drag.png" class="drag-cursor">
        </li>
    </ul>
    <div class="ui-state-default" onCLick="addNewSocial(); return false;" id="add">ADD</div>
</div>

脚本:

$(function() {
    $("#sortable").sortable({
        placeholder: "ui-state-highlight"
    });
    $("#sortable").disableSelection();
});

function addNewSocial() {
    $("#sortable").append('<li class="ui-state-default"><img src="" width="100" height="100" /> <input type="text" value="textt" name="user-media-link[]"><input type="hidden" name="social-media-type" value="1"></li>');
}

它工作得很好,但是我不能在输入中输入任何内容.我只能通过TAB按钮到达他们.当我单击它们时,什么也没有发生.您可以看到实时示例.

It's working very well, but I can't type anything to inputs. I can reach them only via TAB button. When I click them, nothing happens. You can see a live example.

我已阅读了与此问题有关的所有问题,但找不到正确的答案.

I was read all questions which related with this question, but i couldn't find right answer.

W3 Validation is OK 
There isn't any error on Firebug 
Operation System : Ubuntu 11.04 
Browser : Firefox

推荐答案

发生这种情况是因为您拥有$("#sortable").disableSelection();.删除它,就可以了.

This happens because you have $("#sortable").disableSelection();. Remove it and will work ok.

http://jsfiddle.net/KbBnu/1/

这篇关于我无法输入文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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