1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Rep Power

    Java script not working

    I have a html code with java script

    html code contains a dropdown menu with two options Pickup and delivery ...
    If I go for Pickup option everythinig has to be hided.
    If I go for delivery option from drop down
    then Pickup location and the text boxes has to be displayed.

    I dont know where I made the mistake.

    I am able to display html code and the java script is not working...

    Could anyone please let me know what went wrong..

    <script type="text/javascript">
    $(document).ready(function (){
                    $("#state").change(function() {
                        // foo is the id of the other select box 
                        if ($(this).val() != "Pickup") {
        <h3> Select Pickup Or Delivery:</h3>
                <select id="state" name="state" style="width: 212px;">
                    <option value="Pickup">Pickup</option>
                    <option value="Delivery">Delivery</option>
            <div class="foo" style="display:none;">
        <h4> Pickup Location:</h4>
                123 Main St, Edison NJ
            <div class="foo" style="display:none;">
        <h3> Enter your address below:</h3>
        <label>Address1</label> <input type="text" name="address1"><br>
        <label>Address2</label> <input type="text" name="address2"><br>
        <label>City</label>     <input type="text" name="city"><br>
        <label>State</label>    <input type="text" name="state"><br>
        <label>Zip Code</label> <input type="text" name="zipcode"><br>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Rep Power
    Do you have jQuery included in your HTML?
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

IMN logo majestic logo threadwatch logo seochat tools logo