asp.net - How do I list all value= options in an html (aspx) page -
i working off .net website has bunch of webforms. user types in data via browser , submitted data pushed sql server database.
i trying analyze data in database struggling because there no code book shows me codes 1, 2, 3 etc represent.
is there relatively simple tool in javascript or can use extract options in dropdown list , tell me how coded ? instance, right-clicking on source code can see mode:
there 3 options: 1=research, 2=test , 3=non-research
.
i've got couple of hundred of these things not want hand...
i thinking there tools (hopefully online, maybe jsfiddle) can automatically.
i have copied snippet of html below. not know if helps page uses:
- bootstrap.js
- jquery.js
some css
<tr> <th class="newpatient-label">mode: </th> <td> <select name="ctl00$cphbody$fvpatient$modedropdownlist" id="cphbody_fvpatient_modedropdownlist"> <option selected="selected" value="1">research</option> <option value="3">non-research</option> <option value="2">test</option> </select> </td> </tr> <tr> <th class="newpatient-label">condition:</th> <td> <select name="ctl00$cphbody$fvpatient$ddlcondition" id="cphbody_fvpatient_ddlcondition"> <option value="1">active</option> <option selected="selected" value="2">inactive</option> </select> </td> </tr> <tr> <th class="newpatient-label">alternate id: </th> <td> <input name="ctl00$cphbody$fvpatient$alternateidtextbox" type="text" value="097175em" id="cphbody_fvpatient_alternateidtextbox" /> <span id="cphbody_fvpatient_rfvpatientcmsid" style="display:none;">*</span> </td> </tr> <tr> <th class="newpatient-label">alias:</th> <td> <input name="ctl00$cphbody$fvpatient$aliastextbox" type="text" value="4159714811" id="cphbody_fvpatient_aliastextbox" /> </td> </tr> <tr> <th class="newpatient-label">preferred language: </th> <td colspan="1"> <select name="ctl00$cphbody$fvpatient$languagedropdown" id="cphbody_fvpatient_languagedropdown"> <option value="3">amharic </option> <option value="4">arabic </option> <option value="5">brazilian portuguese </option> <option value="6">burmese </option> <option value="7">chin </option> <option value="8">chuukese </option> <option value="9">dari </option> <option selected="selected" value="1">english </option> <option value="10">french </option> <option value="11">german </option> <option value="12">greek </option> <option value="13">haitian </option> <option value="14">hindi </option> <option value="15">hmong </option> <option value="16">ilocano </option> <option value="17">indonesian </option> <option value="18">italian </option> <option value="20">japanese </option> <option value="19">jarai </option> <option value="21">karen </option> <option value="22">khmer </option> <option value="23">korean </option> <option value="24">kurdish </option> <option value="25">lao </option> <option value="26">malayalam </option> <option value="27">marshallese </option> <option value="28">nepali </option> <option value="29">oromo </option> <option value="46">other </option> <option value="30">persian </option> <option value="31">polish </option> <option value="32">punjabi </option> <option value="33">romanian </option> <option value="34">rundi </option> <option value="35">russian </option> <option value="36">serbian </option> <option value="2">spanish </option> <option value="37">swahili </option> <option value="38">swedish </option> <option value="39">tagalog </option> <option value="40">tamil </option> <option value="41">thai </option> <option value="42">tigrinya </option> <option value="43">traditional chinese </option> <option value="44">urdu </option> <option value="45">vietnamese </option> </select>
if have html can jquery this.
variable html contains html provided
$(function() { var tmphtml = $(html); var vals = []; //get existing select menus tmphtml.find("select").each(function(index, itm) { var opts = []; //loop through each of menu's options $(this).find("option").each(function(i, opt) { if (opt.text!== '') { opts.push({ value: opt.value, text: opt.text }); } }); //push menu along options array vals.push({ id: itm.id, options: opts }); }); console.log(vals); });
vals contains list of menus along options
Comments
Post a Comment