Retrieving values from a table in HTML using jQuery?

Posted by Mo on Stack Overflow See other posts from Stack Overflow or by Mo
Published on 2010-06-09T13:21:23Z Indexed on 2010/06/09 13:32 UTC
Read the original article Hit count: 125

Filed under:
|
|

Hi

i was just wondering whats the best way to retrieve the following labels and values from this HTMl code using jquery and storing them in to a array or hash map of some sort where i have for e.g "DataSet:" : "prod" or ["Dataset", "Prod"]?

<table id="metric_summary">
    <tbody>   
    <tr class="editable_metrics">
        <td><label>DataSet:</label></td>
       <td><input name="DataSet" value="prod"></td>
    </tr>

    <tr class="editable_metrics">
        <td><label>HostGroup:</label></td>
       <td><input name="HostGroup" value="MONITOR-PORTAL-IAD"></td>
    </tr>

    <tr class="editable_metrics">
        <td><label>Host:</label></td>
       <td><input name="Host" value="ALL"></td>
    </tr>

    <tr class="editable_metrics">
        <td><label>Class:</label></td>
       <td><input name="Class" value="CPU"></td>
    </tr>

    <tr class="editable_metrics">
        <td><label>Object:</label></td>
       <td><input name="Object" value="cpu"></td>
    </tr>

    <tr class="editable_metrics">
        <td><label>Metric:</label></td>
       <td><input name="Metric" value="CapacityCPUUtilization"></td>
    </tr>

thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery