php - SyntaxError: expected expression, got '<' JQuery -
<script> $(document).ready(function(){ $(function() { $("#country").val("<?php echo $_session['country'];?>"); }); }) <td>country:</td> <td colspan="2"><select name="country" id="country"> <option value="93">93-afghanistan</option> <option value="355">355-albania</option> <option value="213">213-algeria</option> <option value="1-684">1-684-american samoa</option> <option value="376">376-andorra</option></td> i trying select drop-down list based on users selection. code given 1 of current user there syntax-error occur. can solve this?
the best solution problem go thrrough appropiate selection , below -
$(document).ready(function(){ var v="<?php echo $_session['country'];?>"; $('#country option[value='+v+']').attr('selected', 'selected'); }) ; and unnecessarily using
$(document).ready(function(){} , $(function() {}); equivalent.. use either 1 of them
Comments
Post a Comment