如何禁用<a href="">

时间:2016-11-09 22:02:26

标签: php jquery mysql

I want to disable this:

<a href="javascript:void(0);" role="button" onclick="edit_user('<?php echo $data['user_id']; ?>')"><i class="glyphicon glyphicon-pencil"></i>

when user_id = 1. Can someone help me?

2 个答案:

答案 0 :(得分:2)

您可以在php中查看$ user_id == 1并回复您需要的代码

{{1}}

答案 1 :(得分:0)

<button type="button" onclick="edit_user('<?php echo $data['user_id']; ?>')" <?php echo $data['user_id']==1 ? 'disabled' : ''; ?>>Click Me!</button>