如何使用jQuery将input:text中的值传递给标签 [英] how to pass value from input:text to label with jquery
本文介绍了如何使用jQuery将input:text中的值传递给标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<input type="text" id="datepicker_value" style="border:none; " />
当我单击以下内联日期选择器时,上面的输入将被填充
Above input get populated when i click on following inline date picker
<div id="datepicker" ></div>
到目前为止,它的工作情况还不错.但是当我单击单击按钮时,我需要获取标签输入的值,该按钮位于不同的div但位于同一页面中.
Up till now its work fine. But i need to get value of input to the label, when i click click button, which is in different div but same page.
<asp:Label ID="update_lbl" runat="server" ></asp:Label>
<asp:Button ID="BTN_confirmation" runat="server" Text="Proceed to Testing Confirmation Page" />
推荐答案
我认为我了解您要执行的操作...您必须在客户端调用此功能,但是如果您的按钮正在回发,我相信标签上的文字仍然会被重置.
I think I understand what you''re trying to do... You''ll have to call this on the client side, but if you''re button is doing a postback, I believe the text on the label will be reset anyway.
function setText() {
(' #<%= update_lbl.ClientID%>').text(
(' #datepicker_value').val()) }
('#datepicker_value').val()) }
在您的按钮中,您可以像这样进行测试.这将停止回发.
OnClientClick ="setText();返回false;"
And in your button, you can TEST like this. This will STOP the postback.
OnClientClick="setText(); return false;"
这篇关于如何使用jQuery将input:text中的值传递给标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文