How to get selector from .html(output)
How to make it works if #register_user is added by function Register() ?
- $("#register_user").focus(function() {
- $(this).attr("value","");
- });
Whole script:
- <script>
- $(document).ready(function(){
-
- $("#faq").change(onSelectChange);
- $("#LinkBox").focus(function() {
- $(this).attr("value","");
- });
-
- $('#sign').click(SignIn);
- $('#register').click(Register);
-
- $("#register_user").focus(function() {
- $(this).attr("value","");
- });
-
-
- });
-
- function onSelectChange(){
- var selected = $("#faq option:selected");
- var output = "";
- if(selected.val() != 0){
- output = "Answer: " + selected.attr('name') ;
- }
- $("#answer").html(output);
- }
-
- function SignIn(){
- var output = "";
- output = '<input type="text" id="signin_user" size="8" maxlenght="8" value="Login" class="signin_user"><input type="password" id="signin_password" size="8" maxlenght="8" value="Password" class="signin_password"><input type="submit" value="Sign In" class="signin_send"/>';
- $("#panel_left").html(output);
- }
-
- function Register(){
- var output = "";
- output = '<input type="text" id="register_user" size="8" value="e-mail" class="register_user"><input type="text" id="register_password" size="8" value="password" class="register_password"><input type="text" id="register_password_verification" size="8" value="password verification" class="register_password_verification"><input type="submit" value="Register" class="register_send"/>';
- $("#panel_left").html(output);
- }
-
- </script>