how can i get exactly length

how can i get exactly length

can you help me in this code always i get length equal zero even div contain data
 if(isset($row['ship_country'])) { echo " <option value='{$row["ship_country"]}' >"; echo $row["ship_country"]; "</option>"; } else { echo "<option value=''>Select</option>";} $query = 'SELECT * FROM `country_dhl` '; $res_qu = mysql_query($query); while ($country = mysql_fetch_array($res_qu)) { echo " <option value='{$country["country"]}'>"; echo $country["country"]; echo "</option>"; } echo "</select>"; ?> </div> <div class="form-group col-md-6" style="display: none;" id="othershipcountry"> <b> City </b> <input type="text" name="shipcity" class="form-control" placeholder="Enter Your City"/> </div> <div class="form-group col-md-6" style="display: none;" id="city_ship"> <input type="text" name="shipcity" class="form-control" placeholder="Enter Your City"/> </div>

jquery to show and hide div

 $(document).ready(function() { $('#othershipcountry').show(); $('#city_ship').hide(); $('#othershipcity').hide(); $('.shipcountry').click(function () { var selected = $(this).val(); if(selected == 'Roma') { $('#othershipcountry').hide(); $('#city_ship').show(); $('#othershipcity').hide(); } else { $('#othershipcountry').show(); $('#city_ship').hide(); $('#othershipcity').hide(); } }); }); jquery when submit $(document).ready(function() { $('#submit').click(function(e) { if ($('#city_ship').css('display') != 'none') { var ship = $('#city_ship').val(); if (ship.length === 0) { console.log("city"); alert("You must choose your Ship city "); e.preventDefault(); } }