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

使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条)

报告相同问题?

悬赏问题

  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源