i am trying to get to input fild id="login_username".
so here is what iam doing

bg_middle2.children.right_login.login.user.login_username? but this dont work. dont worry about sytax error. iam just want to get value of "login_username" from id "bg_middle2"

<div id = 'bg_middle2'>    
    <div id = 'login_content_page_wrapper'>



        <div id='top_login'>
        <h1>InSecure Checkout</h1> <img id="lock_img" src="IMAGE/lock.png" width="25px" height="25px"/>
        </div>



        <div id = "left_login">
        </div>

        <div id = "right_login">
            <form  id='login' action='login.php' method='POST' name=''>
                <h1>Log in to your account!</h1>
                <?php
                    //print errors
                   if(array_key_exists('log_error', $_SESSION) && !empty($_SESSION['log_error']))
                    {
                        $log_error_r = $_SESSION['log_error'];
                        echo "<span style='background-color:#D00000;'> $log_error_r <br/></span>";
                        unset($_SESSION['log_error']);
                    }
                ?>
                <div id="user">
                    <label>Username:</label> 
                    <input type="text" name="username" id="login_username" class="login_field" value="" />
                </div>           

                <div>
                    <label>Password</label>
                    <input type="password" name="password" id="login_password" class="login_field" value=""/>
                </div>           

                <p class="forgot"><a href="#">Forgot your password?</a></p>

                <div id="submit">
                    <button type="submit">Log in</button> 
                        <label>
                            <input type="checkbox" name="remember" id="login_remember" value="yes" />
                                Remember my password
                        </label>    
                </div>
             </form>
            </div>
        </div>
</div>

If you've incorporated jQuery into your project, you can easily get the value of the input field by using the val() method.

For example,

<script>
$(document).ready(function() {
  var inputVal;
  inputVal = $('#login_username').val();
});
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.