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 id = "left_login">

        <div id = "right_login">
            <form  id='login' action='login.php' method='POST' name=''>
                <h1>Log in to your account!</h1>
                    //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>";
                <div id="user">
                    <input type="text" name="username" id="login_username" class="login_field" value="" />

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

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

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

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,

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

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