Semantic UI dropdown selected item on page load -
i'm trying semantic ui's drop down have pre-selected option when page loads in php can't pre-selected ideas?
<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>
ok needs initialised on 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'); ";} ?> });
Comments
Post a Comment