html - jQuery cleanup task -


so may little tricky, take @ div below. need jquery code going go through div, , delete rows or cells contain textbox or dropdown, or kind of input field, without data in it, or blank choice ("" or " "). need delete corresponding label, example in case

    <td>     account number </td> <td>     <%= html.textboxfor(m => m.stpdata.borroweraccountnumber, new { @class = "economictextbox", propertyname = "stpdata.borroweraccountnumber", onchange = "this.value = converttopasswordcharacters(this.value, '*', 4);updatefield(this);" }) %>     </td>   

if above textbox didn't have data in it, wouldn't want see cell contained text 'account number' either. ideas? know tricky, might need jquery expert here.

<table cellpadding="4" cellspacing="0">     <tbody><tr id="tr5">         <td style="text-align: right;">             indication nickname:         </td>         <td id="indicationnickname" colspan="3">             swap         </td>         </tr>         <tr>             <td colspan="4">                 legal name of borrower             </td>         </tr>         <tr>             <td colspan="4">                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                 <select class="borrowerlegalnameid" id="borrowerlegalnameid" name="borrowerlegalnameid" onchange="updatefield(this, false);showborrowerlegalname();" propertyname="borrowerlegalnameid"><option value=""></option>                     <option value="new borrower">create new borrower</option>                     <option value="0|441185|1001 cassatt, llc">1001 cassatt, llc</option>                     <option value="0|190215|1100 township line road associates, llc">1100 township line road associates, llc</option>                     <option value="0|871197|1102 west street limited partnership">1102 west street limited partnership</option>                     <option value="0|879123|1165 busch real estate associates, llc">1165 busch real estate associates, llc</option>                     <option value="0|440595|1210 american boulevard lp">1210 american boulevard lp</option>                     <option value="0|441188|252 realty partners">252 realty partners</option>                     <option value="0|876775|2617 hp associates">2617 hp associates</option>                     <option value="0|884742|3 seasons, llc">3 seasons, llc</option>                     <option value="0|884223|3l realty, llc">3l realty, llc</option>                     <option value="0|440988|760 sproul road delco lp">760 sproul road delco lp</option>                     <option value="0|770259|805 henderson blvd. associates, l.p.">805 henderson blvd. associates, l.p.</option>                     <option value="0|440948|901 market, llc">901 market, llc</option>                     <option value="0|871026|a. duie pyle">a. duie pyle</option>                     <option value="0|885770|achristavest, llc">achristavest, llc</option>                     <option value="0|876662|acquire land, l.p.">acquire land, l.p.</option>                     <option value="0|886621|allentown refrigerated terminals, inc.">allentown refrigerated terminals, inc.</option>                     <option value="0|884116|allentown refrigerated terminals, inc.; g &amp; h international traders, inc.; sel, inc.; uniq ...">allentown refrigerated terminals, inc.; g &amp; h international traders, inc.; sel, inc.; unique brokera...</option>                     <option value="0|883807|american infrastructure">american infrastructure</option>                     <option value="0|876241|american infrastructure, inc. , subsidiaries">american infrastructure, inc. , subsidiaries</option>                     <option value="0|441014|american infrastructure, llc">american infrastructure, llc</option>                     <option value="0|883188|applewood lumber supply company">applewood lumber supply company</option>                     <option value="0|770115|atlantic paper company">atlantic paper company</option>                     <option value="0|441207|atlantic trailer leasing corporation">atlantic trailer leasing corporation</option>                     <option value="0|870247|audubon ventures ii, llc">audubon ventures ii, llc</option>                     <option value="0|879076|avl real estate associates, llc">avl real estate associates, llc</option>                     <option value="0|887667|b &amp; g coastal enterprises, inc., william a. gibbs, jr., , raymond c. shockley">b &amp; g coastal enterprises, inc., william a. gibbs, jr., , raymond c. shockley</option>                     <option value="0|880491|b&amp;g equipment company">b&amp;g equipment company</option>                     <option value="0|882948|barnes associates - i">barnes associates - i</option>                     <option value="0|877884|bayview crossing, llc">bayview crossing, llc</option>                     <option value="0|441148|beacon revex, llc">beacon revex, llc</option>                     <option value="0|877762|beaver brook crossing, llc">beaver brook crossing, llc</option>                     <option value="0|887877|bentley family partnership i, l.p.">bentley family partnership i, l.p.</option>                     <option value="0|888740|bernstein-ryan, llc.">bernstein-ryan, llc.</option>                     <option value="0|888845|berwind property group, inc.">berwind property group, inc.</option>                     <option value="0|440483|bestfield properties, llc">bestfield properties, llc</option>                     <option value="0|873569|bjh properties, inc">bjh properties, inc</option>                     <option value="0|883906|brackenville crossing, llc">brackenville crossing, llc</option>                     <option value="0|884234|brandywine country club">brandywine country club</option>                     <option value="0|883937|brothers, inc.">brothers, inc.</option>                     <option value="0|884895|bryn eyre, l.p.">bryn eyre, l.p.</option>                     <option value="0|440460|burris logistics">burris logistics</option>                     <option value="0|441186|cassford associates">cassford associates</option>                     <option value="0|887627|cd gaither associates, llc">cd gaither associates, llc</option>                     <option value="0|887643|cd lincoln associates, llc , cd 2000 lincoln associates, llc">cd lincoln associates, llc , cd 2000 lincoln associates, llc</option>                     <option value="0|882854|chapman lane investors, lp">chapman lane investors, lp</option>                     <option value="0|888310|chichester business park, llc">chichester business park, llc</option>                     <option value="0|884123|chincoteague hotel, lc">chincoteague hotel, lc</option>                     <option value="0|441194|coin automatic laundry equipment co.">coin automatic laundry equipment co.</option>                     <option value="0|879273|cornell &amp; company, inc.">cornell &amp; company, inc.</option>                     <option value="0|873492|country day school">country day school</option>                     <option value="0|5831|country day school @ overbrook">country day school @ overbrook</option>                     <option value="0|885461|croftley properties, inc.">croftley properties, inc.</option>                     <option value="0|886910|d.b.r., llc">d.b.r., llc</option>                     <option value="0|886168|dann fleet, lc">dann fleet, lc</option>                     <option value="0|885550|dbw enterprises, llc">dbw enterprises, llc</option>                     <option value="0|5978|dci-800 devon park drive, l.p.">dci-800 devon park drive, l.p.</option>                     <option value="0|441015|ddlm, lp">ddlm, lp</option>                     <option value="0|879887|delaware hospice">delaware hospice</option>                     <option value="0|441334|delcard associates, inc.">delcard associates, inc.</option>                     <option value="0|879272|delor d'andrea cornell">delor d'andrea cornell</option>                     <option value="0|885068|deluca lot investors, l.p.">deluca lot investors, l.p.</option>                     <option value="0|770103|dkm associates">dkm associates</option>                     <option value="0|888368|east coast ag holdings, limited partnership">east coast ag holdings, limited partnership</option>                     <option value="0|875452|eastern athletic clubs realty llc">eastern athletic clubs realty llc</option>                     <option value="0|873841|eastern warehouse distributors, inc">eastern warehouse distributors, inc</option>                     <option value="0|885345|endless pools">endless pools</option>                     <option value="0|885768|eustace w. mita">eustace w. mita</option>                     <option value="0|440539|evergreen equipment leasing co., inc.">evergreen equipment leasing co., inc.</option>                     <option value="0|872146|finnaren &amp; haley">finnaren &amp; haley</option>                     <option value="0|884561|fr gordon property holding lp , gordon drive holdings i, llc">fr gordon property holding lp , gordon drive holdings i, llc</option>                     <option value="0|441252|frank w. winne co., inc.">frank w. winne co., inc.</option>                     <option value="0|440991|fraternal properties, llc">fraternal properties, llc</option>                     <option value="0|886247|frederick w. hertrich, iv &amp; christopher hertrich">frederick w. hertrich, iv &amp; christopher hertrich</option>                     <option value="0|879521|fusco properties, lp">fusco properties, lp</option>                     <option value="0|440875|gary t. , ann nolan">gary t. , ann nolan</option>                     <option value="0|440116|gary t. nolan">gary t. nolan</option>                     <option value="0|886399|george krapf, jr. , sons, inc.">george krapf, jr. , sons, inc.</option>                     <option value="0|440523|glenwood one, llc">glenwood one, llc</option>                     <option value="0|878606|green homes real estate, lp">green homes real estate, lp</option>                     <option value="0|873539|gretz beverage bucks, inc.">gretz beverage bucks, inc.</option>                     <option value="0|873538|gretz beverage montco, inc.">gretz beverage montco, inc.</option>                     <option value="0|872798|h.p. cadwallader, inc.">h.p. cadwallader, inc.</option>                     <option value="0|876293|hair systems, inc.">hair systems, inc.</option>                     <option value="0|885325|hankin eagleview associated, lp">hankin eagleview associated, lp</option>                     <option value="0|190204|hankin eagleview associates">hankin eagleview associates</option>                     <option value="0|440692|hat wit 1 llc">hat wit 1 llc</option>                     <option value="0|886410|haverford reserve, lp">haverford reserve, lp</option>                     <option value="0|878097|heritage dairy stores, inc">heritage dairy stores, inc</option>                     <option value="0|877765|hockessin village center, llc">hockessin village center, llc</option>                     <option value="0|883640|holly oak crossing, llc">holly oak crossing, llc</option>                     <option value="0|888332|ifurs holdings, inc.">ifurs holdings, inc.</option>                     <option value="0|884184|image first atlanta, llc">image first atlanta, llc</option>                     <option value="0|884508|image first of se florida, llc">image first of se florida, llc</option>                     <option value="0|441286|image first uniform rental service, inc. &amp; image first professional apparel, inc.">image first uniform rental service, inc. &amp; image first professional apparel, inc.</option>                     <option value="0|888205|ivymont gloucester township associates, l.p.">ivymont gloucester township associates, l.p.</option>                     <option value="0|770295|j&amp;l building materials, inc.">j&amp;l building materials, inc.</option>                     <option value="0|874199|james a. perdue">james a. perdue</option>                     <option value="0|883789|jenbrooke properties, inc">jenbrooke properties, inc</option>                     <option value="0|440587|jesters corner, l.l.c.">jesters corner, l.l.c.</option>                     <option value="0|874922|john rock, inc.">john rock, inc.</option>                     <option value="0|873643|k &amp; r leasing co.">k &amp; r leasing co.</option>                     <option value="0|886289|k.w. lands, l.l.c.">k.w. lands, l.l.c.</option>                     <option value="0|441095|k.w. lodging, l.l.c.">k.w. lodging, l.l.c.</option>                     <option value="0|884069|kent narrows hotel, llc">kent narrows hotel, llc</option>                     <option value="0|770286|kinsale properties llc">kinsale properties llc</option>                     <option value="0|879191|krishnas, llc">krishnas, llc</option>                     <option value="0|884735|l&amp;w partners, l.p.">l&amp;w partners, l.p.</option>                     <option value="0|885685|lambdin development limited liability company">lambdin development limited liability company</option>                     <option value="0|877766|laurel crossing, llc">laurel crossing, llc</option>                     <option value="0|440878|liborio lp">liborio lp</option>                     <option value="0|441483|main line watercraft realty lp">main line watercraft realty lp</option>                     <option value="0|190041|mark , ruth handler">mark , ruth handler</option>                     <option value="0|883330|mcelderry bloomberg, llc">mcelderry bloomberg, llc</option>                     <option value="0|882986|midway realty corporation">midway realty corporation</option>                     <option value="0|886290|modern mushroom farms, inc.">modern mushroom farms, inc.</option>                     <option value="0|871668|myers family partnership">myers family partnership</option>                     <option value="0|872463|mz 9285, llc">mz 9285, llc</option>                     <option value="0|872973|national label company">national label company</option>                     <option value="0|887793|nb partners, llc">nb partners, llc</option>                     <option value="0|876344|nh &amp; mp properties, l.p.">nh &amp; mp properties, l.p.</option>                     <option value="0|875343|o.p. schuman , sons, inc.">o.p. schuman , sons, inc.</option>                     <option value="0|884115|orefield cold storage , distribution, inc.">orefield cold storage , distribution, inc.</option>                     <option value="0|871220|parkway gravel, inc.">parkway gravel, inc.</option>                     <option value="0|890862|pavilion east associates, l.p. - wt">pavilion east associates, l.p. - wt</option>                     <option value="0|877761|penn green crossing, llc">penn green crossing, llc</option>                     <option value="0|877764|pennsville crossing, llc">pennsville crossing, llc</option>                     <option value="0|886352|pennsylvania machine works, inc. , texas pmw, inc.">pennsylvania machine works, inc. , texas pmw, inc.</option>                     <option value="0|440185|philmont associates, l.p.">philmont associates, l.p.</option>                     <option value="0|888303|pohlig @ haverford reserve, l.p.">pohlig @ haverford reserve, l.p.</option>                     <option value="0|888808|pre holding hampstead llc">pre holding hampstead llc</option>                     <option value="0|890868|preit associates, l.p. - wt">preit associates, l.p. - wt</option>                     <option value="0|873682|preston schell &amp; r. justin healy">preston schell &amp; r. justin healy</option>                     <option value="0|873457|quinn family restaurants llc">quinn family restaurants llc</option>                     <option value="0|440946|red mill square, llc">red mill square, llc</option>                     <option value="0|886274|rer, llc">rer, llc</option>                     <option value="0|440501|reybold venture group iv llc">reybold venture group iv llc</option>                     <option value="0|440800|ribon partnership, ltd">ribon partnership, ltd</option>                     <option value="0|440184|rmf associates">rmf associates</option>                     <option value="0|886470|route 73 express car wash llc">route 73 express car wash llc</option>                     <option value="0|190218|rumsey electric company....">rumsey electric company....</option>                     <option value="0|885659|salisbury lodging, llc">salisbury lodging, llc</option>                     <option value="0|883739|seaford commons, llc">seaford commons, llc</option>                     <option value="0|884020|semanoff, ormsby, greenberg &amp; torchia, llc">semanoff, ormsby, greenberg &amp; torchia, llc</option>                     <option value="0|883509|sher-rockee mushroom farms, llc">sher-rockee mushroom farms, llc</option>                     <option value="0|440945|shipyard center, llc">shipyard center, llc</option>                     <option value="0|877885|shoppes of mount pleasant, llc">shoppes of mount pleasant, llc</option>                     <option value="0|877763|shoppes of st. georges, inc.">shoppes of st. georges, inc.</option>                     <option value="0|440457|shoreline grading inc.">shoreline grading inc.</option>                     <option value="0|885360|sleep tight, llc">sleep tight, llc</option>                     <option value="0|886509|sora housing, llc">sora housing, llc</option>                     <option value="0|875174|southdown homes, lp">southdown homes, lp</option>                     <option value="0|441060|st. michaels equity, llc">st. michaels equity, llc</option>                     <option value="0|877636|stephen a. thorne">stephen a. thorne</option>                     <option value="0|885627|stoltzfus property management, llc">stoltzfus property management, llc</option>                     <option value="0|440586|stoney creek plaza llc">stoney creek plaza llc</option>                     <option value="0|883508|storage partners of cherry hill, llc">storage partners of cherry hill, llc</option>                     <option value="0|883849|storage partners of exton, lp">storage partners of exton, lp</option>                     <option value="0|441216|tague family limited partnership">tague family limited partnership</option>                     <option value="0|876244|tague lumber, inc.">tague lumber, inc.</option>                     <option value="0|881423|the california mushroom farm">the california mushroom farm</option>                     <option value="0|883503|the myers family partnership ii, lp/ a. ross myers">the myers family partnership ii, lp/ a. ross myers</option>                     <option value="0|887978|the sands incorporated">the sands incorporated</option>                     <option value="0|883542|thomas automotive">thomas automotive</option>                     <option value="0|883641|townsend crossing, llc">townsend crossing, llc</option>                     <option value="0|887573|traditions of america, l.p.">traditions of america, l.p.</option>                     <option value="0|883607|trion group inc.">trion group inc.</option>                     <option value="0|190201|united electric supply company, inc.">united electric supply company, inc.</option>                     <option value="0|877767|upper chi crossing, llc">upper chi crossing, llc</option>                     <option value="0|441169|urie , blanton inc. ......">urie , blanton inc. ......</option>                     <option value="0|883795|v&amp;n">v&amp;n</option>                     <option value="0|887774|vandemark &amp; lynch, inc. , v d &amp; l holdings, inc.">vandemark &amp; lynch, inc. , v d &amp; l holdings, inc.</option>                     <option value="0|884105|village of 5 points ventures, llc">village of 5 points ventures, llc</option>                     <option value="0|875937|washington west associates, l.p.">washington west associates, l.p.</option>                     <option value="0|876845|west north llc">west north llc</option>                     <option value="0|870541|wilkinson heritage, l.l.c.">wilkinson heritage, l.l.c.</option>                     <option value="0|884485|william s. vail">william s. vail</option>                     <option value="0|884803|wkg schafer">wkg schafer</option>                     <option value="0|875138|worth , worth new jersey llc">worth , worth new jersey llc</option>                     <option value="0|440750|worth , worth partnership">worth , worth partnership</option>                 </select>             </td>         </tr>         <tr style="display: none;" class="borrowerlegalname">             <td colspan="4">                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                 <input class="economictextbox" id="borrower_companyname" name="borrower.companyname" onchange="updatefield(this);" propertyname="borrower.companyname" style="width: 560px;" value="" type="text">             </td>         </tr>         <tr>             <td>                 asc 820 credit spread (bps)             </td>             <td>                 <input class="economictextbox" id="stpdata_derivativecreditspread" name="stpdata.derivativecreditspread" onchange="updatefield(this);" propertyname="stpdata.derivativecreditspread" value="" type="text">             </td>             <td>                 date borrower isda signed             </td>             <td>                 <input class="economictextbox hasdatepicker" datatype="date" id="stpdata_borrowerisdasigneddate" name="stpdata_borrowerisdasigneddate" onchange="parseandsetdt(this); " propertyname="stpdata.borrowerisdasigneddate" value="" type="text"><img title="..." alt="..." src="http://localhost/extranet/img/icon_frequency2.gif" class="ui-datepicker-trigger">             </td>         </tr>         <tr>             <td>                 payment method             </td>             <td>                 <select id="stpdata_paymentmethodid" name="stpdata.paymentmethodid" onchange="updatefield(this);" propertyname="stpdata.paymentmethodid"><option value=""></option>                     <option value="6701">check</option>                     <option value="6704">debit account</option>                     <option selected="selected" value="6700">debit dda</option>                     <option value="6702">settle branch</option>                     <option value="6703">wire transfer</option>                 </select>             </td>             <td>                 borrower valuation report interval             </td>             <td>                 <select id="stpdata_borrowerreportinterval" name="stpdata.borrowerreportinterval" onchange="updatefield(this);" propertyname="stpdata.borrowerreportinterval"><option value=""></option>                     <option value="5650">monthly</option>                     <option value="5651">quarterly</option>                     <option value="5652">semiannually</option>                     <option value="5653">annually</option>                 </select>             </td>         </tr>         <tr>             <td>                 account number             </td>             <td>                 <input class="economictextbox" id="stpdata_borroweraccountnumber" name="stpdata.borroweraccountnumber" onchange="this.value = converttopasswordcharacters(this.value, '*', 4);updatefield(this);" propertyname="stpdata.borroweraccountnumber" value="" type="text">             </td>             <td>                 internal reference number             </td>             <td>                 <input class="economictextbox" id="stpdata_internalreferencenumber" name="stpdata.internalreferencenumber" onchange="updatefield(this);" propertyname="stpdata.internalreferencenumber" value="" type="text">             </td>         </tr>         <tr>             <td colspan="2">                 &nbsp;             </td>             <td>                 loan reference number             </td>             <td>                 <input class="economictextbox" id="stpdata_loanreferencenumber" name="stpdata.loanreferencenumber" onchange="this.value = converttopasswordcharacters(this.value, '*', 4);updatefield(this);" propertyname="stpdata.loanreferencenumber" value="" type="text">             </td>         </tr>         <tr>             <td colspan="4" id="contactsforborrower">                 <b>contacts</b>                 <table id="borrowercontactsgrid" class="resultsgrid" cellpadding="2" cellspacing="0">                     <tbody><tr>                         <td class="resultssubheader">                             name                         </td>                         <td class="resultssubheader">                             type                         </td>                         <td class="resultssubheader">                             payment notice delivery                         </td>                         <td class="resultssubheader">                             borrower report delivery                         </td>                         <td class="resultssubheader">                             fax number/email address                         </td>                         <td id="action" class="resultssubheader">                             action                         </td>                         </tr>                          <tr>                             <td colspan="6">                                 no contacts                             </td>                         </tr>                      </tbody></table>               </td>         </tr>     </tbody></table> 

this should work:

$('table').find('input, select, textarea').each(function() {     if ( !$.trim(this.value) ) {         $(this).closest('td').remove();     } }); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -