dimanche 25 mars 2018

get a item ID by its child (vanilla JS)

I want to check if a form has an option CAD (in 7th level), if it has, then get the form id.

// first level   
<form id="15" method="post" action="/open a new page" target="_blank">

        //second level- 1                               
        <div>   
            <input type="hidden" id="CHECK" name="CHECK">
        </div>

        //secode leve - 2
        <table cellpadding="0" cellspacing="0" border="0" width="100%">

            // 3rd level
            <tbody>

                //4th level
                <tr>    

                  // 5th level                                                      
                  <td>
                    <input type="hidden" name="name" value="Frank">                                                             
                    <input type="hidden" name="identifier" value="12345">
                    <input type="hidden" name="code" value="299 ">
                    <input type="hidden" name="type" value="060201">
                    <input type="hidden" name="claim" value="4567">
                    <input type="hidden" name="departement" value="IT">
                    <input type="hidden" name="city" value="S25">
                    <input type="hidden" name="num" value="28936">
                    <input type="hidden" name="typeClient" value="2">
                    <input type="hidden" name="numTel" value="4444">
                    <input type="hidden" name="prod" value="MMM">
                    <input type="hidden" name="label" value="doc">

                    //6th level
                    <select name="docToSeize" style="width:150px" class="form1">

                           // 7th levle
                           <option value="11">RAP </option>
                           <option value="12">CAD </option>
                           <option value="18">GGO</option>
                           <option value="1A">HYU</option>
                     </select>

                   </td>

                   <td valign="top">
                       <input type="submit" class="boutonbleuok" style="cursor: hand" value="ok" onclick="label">
                   </td>
               </tr>
            </tbody>
        </table>
    </form>




Aucun commentaire:

Enregistrer un commentaire