在html属性中,设置disabled ="disabled".不工作 [英] In html attributes setting disabled = "disabled" not working

查看:831
本文介绍了在html属性中,设置disabled ="disabled".不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

@Html.ActionLink(" ", "Edit", new { id = item.UserId }, new { title = "User is not editable" , @class = "edit_btn", disabled = "disabled"})

我想通过设置html属性disable ="disabled"来禁用ActionLink,但是它不起作用.我可以获取类和标题属性,但没有禁用actionLink.

I want to disable ActionLink by setting html attribute disabled ="disabled", but its not working. I am able to get class and title attributes but actionLink is not getting disabled.

任何人都可以帮忙.我做错了什么地方.

Can anyone help.. Where I am doing wrong.

推荐答案

disabled属性在锚标记中不起作用. MVC呈现了您期望的结果,disabled="disabled",但是浏览器只是忽略了它.

The disabled attribute doesn't work in anchor tags. MVC renders what you expect, disabled="disabled", but browsers just ignore it.

您需要做一些不同的事情,例如根本不渲染锚,而仅渲染文本或在span中.

You need to do something different, such as not rendering an anchor at all, but just render the text or in a span.

这篇关于在html属性中,设置disabled ="disabled".不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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