Click here to Skip to main content
15,905,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have one popup in button click event..In this popup i have 2 textboxes....In this I need focus in first textbox...

Below script is for popup display action...

<script language="javascript" type="text/ecmascript">
       window.addEvent('domready', function () {
           debugger;
           var myLogin = new mooSlide2({ slideSpeed: 1500, fadeSpeed: 500, toggler: 'login', content: 'loginPanel',  height: 250, close: false, effects: Fx.Transitions.Bounce.easeOut, from: 'top',  });
            $('close').addEvent('click', function (e) {
               e = new Event(e);
               myLogin.clearit();
               e.stop();
           });
       });</script>


This is the design inside the textbox.....
<label for="logf" style="padding-left: 25px">
               Email: 
           </label>
           <label style="padding-left: 25px">
               <asp:TextBox ID="log" MaxLength="42" TabIndex="1002" runat="server" onfocus="if(value=='log:') value = ''"></asp:TextBox>
           </label>
           <label for="pwdf" style="padding-left: 25px">
               Password:</label>
           <label style="padding-left: 25px">
               <asp:TextBox ID="pwd" MaxLength="8" runat="server" TabIndex="1003" TextMode="Password"></asp:TextBox>
           </label>
           <label style="padding-left: 50px">
               <a tabindex="1004">
                   <img id="imgbutton" alt="" src="Staticimage/logingray.png" title="Login" border='0'
                        önclick="return validate()" style="cursor: pointer;" /></a>
           </label>


I need focus in first textbox that ID="log"...

Can anyone help me....
Posted

write this code in button click event for the popup.

try this to focus on textbox by id
JavaScript
$("#log").Focus();

or
if you have to focus on first textbox
JavaScript
$('input:text:first').focus();
 
Share this answer
 
v2
Comments
[no name] 25-Jun-12 8:00am    
5! up..
Azziet 28-Jun-12 3:57am    
thanx
Dear Friend, Try this.

TxtLog.Focus();
 
Share this answer
 
Comments
vivekx2 25-Jun-12 3:24am    
hello friend,,,
where to place this code in design or in script....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900