对于Internet Explorer中的html输入按钮,新行不会显示

时间:2023-01-28 09:24:03

I have a Html Input button:

我有一个Html输入按钮:

  <input id="Meal17" runat="server" type="button" style="height: 60px; width: 235px; display: block;" class="arrayinput" />

and now i want to set value for it with JQuery :

现在我想用JQuery为它设置值:

  $("#Meal17").click(function (e) {
  $(this).val("hello" + "\n" + "this is test" );
}

now in INTERNET Explorer the new line in my button value dosn't ocured,why??how can i solve it. thanks alot.

现在在INTERNET资源管理器中我的按钮值中的新行不会出现,为什么?我怎么能解决它。非常感谢。

2 个解决方案

#1


0  

Use the button element instead and use <br> for a line break inside it:

使用button元素代替并使用
在其中进行换行:

<button id="Meal17" runat="server" type="button"
style="height: 60px; width: 235px; display: block;"
class="arrayinput">Hello<br>this is test</button>

Or, using jQuery as in your case,

或者,在您的情况下使用jQuery,

$("#Meal17").click(function (e) {
  $(this).html("hello<br>this is test" );
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="Meal17" runat="server" type="button"
  style="height: 60px; width: 235px; display: block;" class="arrayinput">Dummy</button>

#2


-1  

This is a known problem in Internet Explorer. As a workaround, insert a <br> element instead of a newline character.

这是Internet Explorer中的已知问题。作为解决方法,插入
元素而不是换行符。

#1


0  

Use the button element instead and use <br> for a line break inside it:

使用button元素代替并使用
在其中进行换行:

<button id="Meal17" runat="server" type="button"
style="height: 60px; width: 235px; display: block;"
class="arrayinput">Hello<br>this is test</button>

Or, using jQuery as in your case,

或者,在您的情况下使用jQuery,

$("#Meal17").click(function (e) {
  $(this).html("hello<br>this is test" );
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="Meal17" runat="server" type="button"
  style="height: 60px; width: 235px; display: block;" class="arrayinput">Dummy</button>

#2


-1  

This is a known problem in Internet Explorer. As a workaround, insert a <br> element instead of a newline character.

这是Internet Explorer中的已知问题。作为解决方法,插入
元素而不是换行符。