Microsoft Edge 上的禁用文本框不可选择 [英] Disabled textbox on Microsoft Edge is not selectable

查看:91
本文介绍了Microsoft Edge 上的禁用文本框不可选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网页中,我需要一个禁用的文本框来显示内容(很长).

In my webpage, I need a disabled textbox to show content (very long).

<input disabled type="text" value="a very long long long text...">

在 Chrome 中,我们可以选择禁用输入中的文本滚动查看所有内容.但是,在 MS Edge 中,似乎无法选择禁用的文本框,因此无法滚动查看整个内容.无论如何,是否可以自定义 CSS 以在 Ms Edge 上禁用文本框上选择文本.

In Chrome, we can select the text in the disabled input to scroll to view all content. However, In MS Edge, it seems that the disabled textbox is not selectable, therefore, it cannot be scrolled to view entire content. Is there anyway to customize CSS to select text on disabled textbox on Ms Edge.

推荐答案

实际上可以从 Edge 中禁用的文本框中选择内容,但它不会像在 Chrome 中滚动那样滚动.

Actually content is selectable from disabled textbox in Edge but it will not scroll like it scrolls in Chrome.

<!DOCTYPE html>
<html>
<body>
<form action="">
 
  Text : <input type="text" name="txt1" value="Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries." disabled><br>
  <input type="submit" value="Submit"><br>
<textarea rows="4" cols="50">
</textarea>
</form>
</body>
</html>

Edge 浏览器中的输出:

Output in Edge browser:

因此,如果您的要求是选择文本,那么正如您在我的测试结果中所看到的那样.

So if your requirement is to select the text than it is possible as you can see in my testing result.

如果您的要求是滚动内容,那么目前无法使用 MS Edge 浏览器.作为一种变通方法,您可以尝试使用 只读 而不是@Turnip 已经建议的禁用.它将允许用户滚动文本框中的文本.

If your requirement is to scroll the content then at present it is not possible with MS Edge browser. As a work around, you can try to use read only instead of disabled as already suggested by @Turnip. It will allow user to scroll the text in textbox.

我将尝试通过我们的内部渠道向 Microsoft 提交有关此问题的反馈.

I will try to submit the feedback to Microsoft via our internal channel regarding this issue.

这篇关于Microsoft Edge 上的禁用文本框不可选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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