I tried like this
我试过这样的
<script type="text/javascript">
$(document).ready(function () {
$('#divID').hide();
$('#txtInsertComments').Onfocus(function () {
$('#divID').show(); });
});
</script>
//Asp.net Design
<asp:TextBox ID="txtInsertComments" runat="server" Text="Demo"></asp:TextBox>
<div runat="server" id="divID">
This is Div
</div>
but still not working... please help me out ...
但还是不行......请帮帮我...
1 个解决方案
#1
1
If you are using this with Master Page
then the ID of your Textbox
will change.So use this.
如果您在Master Page中使用它,那么Textbox的ID将会改变。所以请使用它。
$('<%txtInsertComments.ClientID%>').focus(function () {
$('#divID').show(); });
});
If you are not using Master Page
then this should work
如果您没有使用母版页,那么这应该可行
$('#txtInsertComments.ClientID').focus(function () {
$('#divID').show(); });
});
#1
1
If you are using this with Master Page
then the ID of your Textbox
will change.So use this.
如果您在Master Page中使用它,那么Textbox的ID将会改变。所以请使用它。
$('<%txtInsertComments.ClientID%>').focus(function () {
$('#divID').show(); });
});
If you are not using Master Page
then this should work
如果您没有使用母版页,那么这应该可行
$('#txtInsertComments.ClientID').focus(function () {
$('#divID').show(); });
});