javascript - Select multiple id's with almost same name -


this question has answer here:

i have of form automatically generated js provider unfortunately can't change...

but know if there's solution allows me select id's begin same string : easi_fielddiv_lastname, easi_fielddiv_firstname, easi_fielddiv_email etc... because idea select of them , apply them class more eficient css.

here's form code :

<div id="easiformarea">    <form name="easiform" id="easiform" class="easiform">       <div id="easi_fielddiv_salutation">          <span id="easi_labelspan_salutation"><label id="easi_fieldlabel_salutation">civilité</label></span>          <span id="easi_fieldspan_salutation">             <select id="fld_salutation" name="fld_salutation" label="civilité" mandatory="true">                <option value="" label=""></option>                <option value="mme" label="madame">madame</option>                <option value="mlle." label="mademoiselle">mademoiselle</option>                <option value="mr" label="monsieur">monsieur</option>             </select>          </span>          <span id="easi_fielmandatoryspan_salutation" class="mandatory"> * </span>       </div>       <div id="easi_fielddiv_lastname"><span id="easi_labelspan_lastname"><label id="easi_fieldlabel_lastname">nom</label></span><span id="easi_fieldspan_lastname"><input id="fld_lastname" type="text" name="fld_lastname" label="nom" mandatory="true"></span><span id="easi_fielmandatoryspan_lastname" class="mandatory"> * </span></div>       <div id="easi_fielddiv_firstname"><span id="easi_labelspan_firstname"><label id="easi_fieldlabel_firstname">prénom</label></span><span id="easi_fieldspan_firstname"><input id="fld_firstname" type="text" name="fld_firstname" label="prénom" mandatory="true"></span><span id="easi_fielmandatoryspan_firstname" class="mandatory"> * </span></div>       <div id="easi_fielddiv_email"><span id="easi_labelspan_email"><label id="easi_fieldlabel_email">email</label></span><span id="easi_fieldspan_email"><input id="fld_email" type="text" name="fld_email" label="email" mandatory="true"></span><span id="easi_fielmandatoryspan_email" class="mandatory"> * </span></div>       <div id="easi_fielddiv_officephonenumber"><span id="easi_labelspan_officephonenumber"><label id="easi_fieldlabel_officephonenumber">téléphone</label></span><span id="easi_fieldspan_officephonenumber"><input id="fld_officephonenumber" type="text" name="fld_officephonenumber" label="téléphone" mandatory="false"></span></div>       <div id="easi_fielddiv_cs_booking"><span id="easi_labelspan_cs_booking"><label id="easi_fieldlabel_cs_booking">booking</label></span><span id="easi_fieldspan_cs_booking"><input id="fld_cs_booking" type="text" name="fld_cs_booking" label="booking" mandatory="false"></span></div>       <div id="easi_fielddiv_cs_subject">          <span id="easi_labelspan_cs_subject"><label id="easi_fieldlabel_cs_subject">sujet</label></span>          <span id="easi_fieldspan_cs_subject">             <select id="fld_cs_subject" name="fld_cs_subject" label="sujet" mandatory="true">                <option value="" label=""></option>                <option value="1" label="je veux annuler mon vol">je veux annuler mon vol</option>             </select>          </span>          <span id="easi_fielmandatoryspan_cs_subject" class="mandatory"> * </span>       </div>       <div id="easi_fielddiv_cs_subsubject">          <span id="easi_labelspan_cs_subsubject"><label id="easi_fieldlabel_cs_subsubject">sous-sujet</label></span>          <span id="easi_fieldspan_cs_subsubject">             <select id="fld_cs_subsubject" name="fld_cs_subsubject" label="sous-sujet" mandatory="true">                <option value="" label=""></option>             </select>          </span>          <span id="easi_fielmandatoryspan_cs_subsubject" class="mandatory"> * </span>       </div>       <div id="easi_fielddiv_description"><span id="easi_labelspan_description"><label id="easi_fieldlabel_description">description</label></span><span id="easi_fieldspan_description"><textarea id="fld_description" name="fld_description" label="description" mandatory="false"></textarea></span></div>       <div id="easi_fielddiv_attachedfiles">          <span id="easi_labelspan_attachedfiles"><label id="easi_fieldlabel_attachedfiles">pièces jointes</label></span>          <span id="easi_fieldspan_attachedfiles">             <div id="fld_attachedfilesarea"> <input id="fld_attachedfiles" type="file" name="fld_attachedfiles" label="pièces jointes" mandatory="false" multiple=""></div>          </span>       </div>       <span class="easiformmessages" id="easiformmessages"></span>    </form>    <div class="mandatoryfieldmention" id="mandatoryfieldmention">* champs obligatoires</div>    <div class="additionnalinformation" id="additionnalinformation">un numéro de dossier renseigné est une demande traitée plus rapidement!</div>    <button id="validatebutton" class="validatebutton" onclick="myformbuilder.valideasiform();">envoyer</button> </div> 

i tried select element tag name on inputs , parent().parent() reach id's interest me doesn't seem work...

so appreciated !!! :)

you can try (jquery needed)

  $('*[id^="easi_fielddiv"]'); 

this select element (*) start (^) 'easy_fielddiv'


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -