jquery - Destroy function in javascript -


i have app going create dropdown selectors find folder inside folder. going display in end index.html file. if there file called index.html, loaded in iframe. stop showing index file , stop creating new dropdown selector file inside folder. if there other folders js or css or images, show them. can me modify code , index.html file stop looking folder inside , stop creating new folder.

here link have app running http://tdhtestserver.herobo.com/

here code looking folders , html files , going create dropdown selectors

function processnewdfdata( respobj, $currentselectitem, strcurrentpath ) {   fsstructure[strcurrentpath] = {'subfolders':[], 'subshtmls':[]};   var hasfolder = false;   if ( (respobj.subfolders.length > 0) || (respobj.subshtmls.length > 0) ) {     for( var = 0; < respobj.subfolders.length; i++ ) {       fsstructure[strcurrentpath].subfolders.push( respobj.subfolders[i] );       hasfolder = true;     }      for( var = 0; < respobj.subshtmls.length; i++ ) {       fsstructure[strcurrentpath].subshtmls.push( respobj.subshtmls[i] );     }   }    rendselects( $currentselectitem, strcurrentpath, hasfolder ); }  function rendselects($currentselectitem, strpath, hasfolder) {        var currentselectlvl = (null === $currentselectitem ? -1 : parseint($currentselectitem.attr('data-selector-level'))),         nextoneselectorhtml =             '<select class="dropdown selectpicker" name="dd" '              + 'data-selector-level="' + (currentselectlvl + 1) + '" '              + 'data-path="' + strpath + '" '             + 'onchange="onfsselectchange(this)"'             + '><option text selected> -- select option -- </option>';   $('div.selectors-container select.dropdown').each(function (i, el) {   if(parseint(el.getattribute('data-selector-level'))>currentselectlvl) {             el.parentnode.removechild(el);             $(el).selectpicker('destroy');   }  });    if ( fsstructure[strpath].subfolders.length > 0 ) {     for(var i=0; < fsstructure[strpath].subfolders.length; i++) {         if(fsstructure[strpath].subfolders[i] != 'highlighted'){         nextoneselectorhtml +=            '<option ' +              'class="subfolder-option" ' +              'data-subfolder="' + fsstructure[strpath].subfolders[i] + '">' +                fsstructure[strpath].subfolders[i] +            '</option>';         }     }   }    if ( fsstructure[strpath].subshtmls.length > 0 ) {     for(var i=0; < fsstructure[strpath].subshtmls.length; i++) {          if (fsstructure[strpath].subshtmls[i] != 'highlighted.html' && fsstructure[strpath].subshtmls[i] != 'index.html'){         nextoneselectorhtml +=            '<option ' +              'class="html-page-option" ' +              'data-html-page-name="' + fsstructure[strpath].subshtmls[i] + '">' +                fsstructure[strpath].subshtmls[i] +            '</option>';         }else{high( strpath+'/highlighted.html');}      }   }    if ( fsstructure[strpath].subshtmls.length > 0 ) {     for(var i=0; < fsstructure[strpath].subshtmls.length; i++) {         if (fsstructure[strpath].subshtmls[i] != 'index.html'){         nextoneselectorhtml +=            '<option ' +              'style="display: none;" ' +             'class="html-page-option" ' +              'data-html-page-name="' + fsstructure[strpath].subshtmls[i] + '">' +                fsstructure[strpath].subshtmls[i] +            '</option>';         }else{playswf( strpath+'/index.html');}     }   }    if(hasfolder) {     nextoneselectorhtml += '</select>';     $('div.selectors-container').append( nextoneselectorhtml );     $('div.selectors-container').trigger('dropdownadded.mh');   } } 

solved

all had add hasfolder = false; on row else{playswf( strpath+'/index.html');hasfolder = false;}


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -