不能在网站上更改div的文本

时间:2017-02-17 10:26:16

标签: html

所以基本上我在网站上有几个可以由用户编辑的div,所以基本上当用户点击div时,应该允许他们更改div中的文本。如果我右键单击网站,我可以更改div的文本,但如果我左键单击div,则没有任何反应。这只发生在ID为editTxt的div中,而对于不同的div则可以正常工作。

<!DOCTYPE html>

<html>
<head>
    <title>Template 1</title>
        <link href="http://localhost/templates/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="body">
    <div class="logo">
        <img class="images" id="image" src="#" alt="Your Logo"/>
    </div>

    <div contenteditable="true" id ="editTxt" class="draggable ">
<p>Main title for the website</p>
    </div>
<div  contenteditable="true" id="content" class="draggable "><p>Change Text inside this box</p></div>


</div>
</body>
</html>

$(function() {
    $('.content-link').click(function(e) {
        e.preventDefault();
        $('#content-link2').load($(this).attr("href"), function() {
            $('#content, #content2, #content3, #editTxt').draggable({
                containment: "#content-link2",
                scroll: false
            });
            $( "#content, #content2, #content3, #editTxt" ).resizable({
                containment: "#content-link2",
                scroll: false,
                handles: 'all',
                maxHeight: 300,
                maxWidth: 300,
                minWidth: 100,
                minHeight: 100,
            });
        });
    });
    return false;
});

0 个答案:

没有答案