我试图让语义用户界面下拉,以便在页面加载php时有一个预先选择的选项,但不能让它预先选择任何想法?
<div class="ui fluid search selection dropdown">
<input type="hidden" name="status">
<i class="dropdown icon"></i>
<div class="default text">Select status</div>
<div class="menu">
<div class="<?php if ($profile['APPROVED']=="0") { echo "active ";} ?>item" data-value="0">XXXX</div>
<div class="<?php if ($profile['APPROVED']=="1") { echo "active ";} ?>item" data-value="1">YYYY</div>
<div class="<?php if ($profile['APPROVED']=="2") { echo "active ";} ?>item" data-value="2">ZZZZ</div>
<div class="<?php if ($profile['APPROVED']=="3") { echo "active ";} ?>item" data-value="3">QQQQ</div>
<div class="<?php if ($profile['APPROVED']=="4") { echo "active ";} ?>item" data-value="4">RRRRR</div>
<div class="<?php if ($profile['APPROVED']=="5") { echo "active ";} ?>item" data-value="5">EEEEE</div>
<div class="<?php if ($profile['APPROVED']=="6") { echo "active ";} ?>item" data-value="6">DDDDD</div>
</div>
</div>
答案 0 :(得分:0)
确定需要在document.ready上初始化:
$(document).ready(function () {
$('.approved.dropdown')
<?php if ($profile['APPROVED']=="0") { echo " .dropdown('set text', 'Pending'); .dropdown('set value', '0'); ";}
if ($profile['APPROVED']=="1") { echo " .dropdown('set text', 'Registered'); .dropdown('set value', '1'); ";}
if ($profile['APPROVED']=="2") { echo " .dropdown('set text', 'Documents Submitted'); .dropdown('set value', '2'); ";}
if ($profile['APPROVED']=="3") { echo " .dropdown('set text', 'Processing'); .dropdown('set value', '3'); ";}
if ($profile['APPROVED']=="4") { echo " .dropdown('set text', 'Approved'); .dropdown('set value', '4'); ";}
if ($profile['APPROVED']=="5") { echo " .dropdown('set text', 'Approved - Photo Uploaded'); .dropdown('set value', '5'); ";}
if ($profile['APPROVED']=="6") { echo " .dropdown('set text', 'Completed'); .dropdown('set value', '6'); ";} ?>
});