简体   繁体   中英

How can i check a radio button by clicking on asp text field using javascript

Hi While working on asp, i want if i click on my asp text field, a radio button should be checked, but i dont find any onClick event available for asp text field, and if i use onchange, it is from the server end, i want this situation without page refresh, just like we do in html fields using javascript, please help!!!

Try this one:

HTML:

<asp:TextBox ID="txtSelect" runat="server" Width="200px" Text="Click here"> </asp:TextBox>
<br />
<asp:RadioButton ID="radCheck" runat="server" />

JQUERY:

$("#txtSelect").click(function(){
    $("#radCheck").attr("checked",true);
});

OnFocus is probably the event I would use.

You can use Ajax if you don't wanna refresh the page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM