doufu8127 2014-01-14 12:53 采纳率: 100%
浏览 42
已采纳

使DIV中的内容无法使用

I want to make the contents within a DIV uneditable but still viewable.

<div id="committee"><?php include 'committee_members_list.php'; ?></div>

The DIV holds the contents of an 'included' file within it. I would like the contents to be viewable but not editable or clickable.

enter image description here The content of the DIV looks as above.

NB: The text and textarea elements are not in the included file that's in the DIV

Everything in the DIV should be viewable as it is but nothing should be clickable/editable. How can i achieve/implement this?

  • 写回答

2条回答 默认 最新

  • dso89762 2014-01-14 12:57
    关注

    Well, you could make all elements in a div container uneditable via JQuery if you want it fast and dynamic.

    <div id="committee">
        <?php include 'committee_members_list.php'; ?>
    </div>
    
    <script type="text/javascript">
        $("#committee").each(function() {
            $(this).attr("readonly", "1");
        });
    </script>
    

    For more security you have to validate everything serversided anyway if it is a form anyway.

    But are input elements nesessary anyway if the content is for read only?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?