I have one select box that hides and displays elements based on its selection.
IN JS PAGE
function showhide() {
$("div.brandDiv").hide();
$("select.slct").bind('change', function() {
$('div.brandDiv').hide();
var targetId = $(this).val();
$('div#' + targetId).show();
});
}
IN HTML call to function showhide()
<select name="ex" class="slct">
and then divs with id non and yes .
< div id="oui" class="brandDiv">
<input type="text" name='num' class="numbersonly" maxlength="2" ></input>
</div>
Its working fine
Problem is when I refresh page it just displays select box with lastly selected option but not elements based on that selection
For example if I have 2 select box options yes and no and if user select yes it shows hello and with no it show By but when i refresh page it shows properly yes or no but not hello or by
I am not very expert .Please help.