javascript - How to choose same option twice -
i open page, in dropdown selected option (value="26"), "rentdropdown" div not showing. how make appear if option selected page opening
<select name="prop_action_category" id="prop_action_category_submit" class="select-submit2" onchange="toggle(this)"> <option value="" disabled selected style="display:none;">label</option> <option value="-1">none</option> <option class="level-0" value="26" selected="selected">1</option> <option class="level-0" value="28">2</option> </select> <p class="half_form half_form_last" id="rentdropdown" style="display: block;"> <select name="property_label" class="cd-select"> <option value="">default</option> <option value="/ 1">per month</option> <option value="/ 2">per week</option> </select> </p> function toggle(el){ var value = el.options[el.selectedindex].value, div = document.getelementbyid('rentdropdown'); if (value === '28' || value ==='-1') { div.style.display = 'none'; } else if (value === '26') { div.style.display = 'block'; } }
just call toggle
function on page load:
toggle(document.getelementbyid('prop_action_category_submit'));
Comments
Post a Comment