Question

I have a html table displayed in a showmodal dialog window, the html-body has several divs, each div having several tables, tr and td within them.

The user will update entries within the input tag so i need to capture the change.

One such div looks like below. How to I retrieve all these values on a button click. I have heard of serialize() method. Will it work for all tag types, "insert","select", "option" etc etc.

<div>
  <table>
    <tr><td></td><td></td><td></td>
    </tr>
  </table>
  <table>
    <tr><td></td><td></td>
    </tr>
    <tr><td></td><td></td><td></td><td></td>
    </tr>
  </table>
  <table>
    <tr><td></td>
    </tr>
  </table>
</div>
Was it helpful?

Solution

Apologies, writing my solution in a pseudocode fashion:

//I created a div container and then loop through all the divs

//then retrieve values using one of the below

    $("classname > div[id]").each(function(){

      var a=   document.getElementsByName("name of the tag");   //by name
      var b=   document.getElementById("id of the tag");      //by id
      var c=   $("input[class='"+trd_id+"']:checked").val();     // for radio button

    });

// loop by div counts and alert the values. Solved my problems

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top