javascript - Jquery show/hide div script broken by HTML -> PHP Arrays, any workaround? -
i working on huge multi page form multiple sub sections , answer dependent sub-questions.
i using jquery show/hide divs based on select values works perfectly. when comes handling data able break down post values page.
i using following syntax in fields
<label>what reference?</label> <input type="text" name="[title][0][reference]" value="<?php echo $out['reference']?>" /><img src="images/hint.png" class="hint" title="edit me!!" /><br />
and calling if else on $_post['title'] , using iterative function handle database side of things.
however i'm finding if breaks jquery show/hide div, functionality of integral form (which has 100's of questions reading many seperate tables).
this jquery script, there anyway enhance/change allow me use html->php arrays?
// works $('#reference').change(function () { var whattoshow = $('#reference').val(); $('div[class^=divarea-]').fadeout(1000); $('.divarea-' + whattoshow).fadein(1000); });
this doesnt work, presumably brackets interferring don't know how escape stuff in java.
// doesnt work $('#[title][0][reference]').change(function () { var whattoshow = $('#[title][0][reference]').val(); $('div[class^=divarea-]').fadeout(1000); $('.divarea-' + whattoshow).fadein(1000); });
doh! sorry should have done more checking, needed use \ in front of each square bracket, works fine now.
Comments
Post a Comment