jQuery multiple DIVs - show/hide reset -
edit 2: best see page in action - http://www.justdoors.co/product-selection - need if chooses in first selection box click next opens dropdown, if goes , changes option in first dropdown need second bit reset , hide until click next on relevent option.
hi [selection box]
if user chooses <option 1>
shows option 1 div info , link show div a if user chooses <option 2>
shows option 2 div info , link show div b if user chooses <option 3>
shows option 3 div info , link show div c
if user clicks on link show div a brings second selection box similar options.
at moment if user has clicked show div a , changes mind first selection dropdown box div a stays there, need reset , hide div a when click link option show new selection.
written way: user chooses <option 1>
clicks link div a >> div a shows user changes mind , selects <option 2>
>> div a needs hide >> user can click link show div b.
this script i'm using shows div a/b/c:
$(document).ready(function() { $('#diva-holder').hide(); $('#diva-link').click(function() { $('#diva-holder').toggle(400); return false; }); $('#divb-holder').hide(); $('#divb-link').click(function() { $('#divb-holder').toggle(400); return false; }); $('#divc-holder').hide(); $('#divc-link').click(function() { $('#divc-holder').toggle(400); return false; }); });
along with:
jquery("#selector1").change(function(){ if (jquery(this).val() == "1" ) { jquery("#option1div").slidedown("fast"); } else { jquery("#option1div").slideup("fast"); } });
to show/hide divs option info @ start.
i'm on complicating matters pointers great!
edit: guess thinking need in selector1 function make sure other divs after hidden, pointers on how can appreciated .
play , let me know if you're looking for: http://jsfiddle.net/bozdoz/rpakg/
the thing did change toggle() hide() , show() particular div based on value of option value. so, hope solves problem: on change, hide every div, show div designated option value. because handler on change, won't inadvertently hide desired div if user selects same div. hide other divs.
Comments
Post a Comment