Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms 如何获取默认选定选项的文本值_Forms_Bitrix - Fatal编程技术网

Forms 如何获取默认选定选项的文本值

Forms 如何获取默认选定选项的文本值,forms,bitrix,Forms,Bitrix,任何帮助都将不胜感激。您应该在中总结js,在使用jquery($)之前,检查是否包含jquery.js库 大概是这样的: $( "#ORDER_PROP_14 option:selected" ).text(); 阿富汗 荷兰 $(“#ORDER_PROP_14 option[value=]”)。PROP('selected',true); $(“#ORDER_PROP_14”).sides('span').html(); $(“#ORDER_PROP_14 option[value=48]

任何帮助都将不胜感激。

您应该在
中总结js,在使用
jquery($)
之前,检查是否包含
jquery.js

大概是这样的:

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

阿富汗
荷兰
$(“#ORDER_PROP_14 option[value=]”)。PROP('selected',true);
$(“#ORDER_PROP_14”).sides('span').html();
$(“#ORDER_PROP_14 option[value=48]”)。PROP('selected',true);
$(“#ORDER_PROP_14”).兄弟姐妹('span').html(48);
$(“#ORDER_PROP_14 option[value=48]”)。PROP('selected',true);
$(“#ORDER_PROP_14”).兄弟姐妹('span').html(48);
$( "#ORDER_PROP_14 option:selected" ).text();
<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>