0
<select name="ORDER_PROP_14" id="ORDER_PROP_14"> <option value="24">Afghanistan</option> <option value="48">Nederland</option> </select> <?php if ( isset($arUser['PERSONAL_COUNTRY']) || !empty($arUser['PERSONAL_COUNTRY']) ) { ?> <?php if ( $arUser['PERSONAL_COUNTRY'] != 0 ) { ?> $("#ORDER_PROP_14 option[value=<?=$arUser['PERSONAL_COUNTRY']?>]").prop('selected', true); $("#ORDER_PROP_14").siblings('span').html(<?=$arUser['PERSONAL_COUNTRY']?>); <?php } else { ?> $("#ORDER_PROP_14 option[value=48]").prop('selected', true); $("#ORDER_PROP_14").siblings('span').html(48); <?php } ?> <?php } else { ?> $("#ORDER_PROP_14 option[value=48]").prop('selected', true); $("#ORDER_PROP_14").siblings('span').html(48); <?php } ?> 

I tried using this code but it seems to be no used.

$( "#ORDER_PROP_14 option:selected" ).text(); 

Any help would be much appreciated.

1 Answer 1

0

You should conclude js in <script></script>, and before use jquery($.) check that jquery.js lib was included.

Something like this:

<span></span> <select name="ORDER_PROP_14" id="ORDER_PROP_14"> <option value="24">Afghanistan</option> <option value="48">Nederland</option> </select> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> <?php if ( isset($arUser['PERSONAL_COUNTRY']) || !empty($arUser['PERSONAL_COUNTRY']) ) { ?> <?php if ( $arUser['PERSONAL_COUNTRY'] != 0 ) { ?> $("#ORDER_PROP_14 option[value=<?=$arUser['PERSONAL_COUNTRY']?>]").prop('selected', true); $("#ORDER_PROP_14").siblings('span').html(<?=$arUser['PERSONAL_COUNTRY']?>); <?php } else { ?> $("#ORDER_PROP_14 option[value=48]").prop('selected', true); $("#ORDER_PROP_14").siblings('span').html(48); <?php } ?> <?php } else { ?> $("#ORDER_PROP_14 option[value=48]").prop('selected', true); $("#ORDER_PROP_14").siblings('span').html(48); <?php } ?> </script> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.