Tuesday 9 December 2014

Get table or gridview textbox value using jquery


//HTML

<table id="GVAnganwadi">
    <tr>
        <td>
            <input type="text" class="firstName" value="foo1">
        </td>
                 <td>
            <input type="text" class="lastName" value="bar1">
        </td>
    </tr>
    <tr>
        <td>
            <input type="text" class="firstName" value="foo2">
        </td>
                <td>
            <input type="text" class="lastName" value="bar2">
        </td>
    </tr>
    <tr>
        <td>
            <input type="text" class="firstName" value="foo3">
        </td>
                 <td>

            <input type="text" class="lastName" value="bar3">
        </td>
    </tr>
    <tr>
        <td>
            <input type="text" class="firstName" value="foo4">
        </td>
                 <td>
            <input type="text" class="lastName" value="bar4">
        </td>
    </tr>
</table>





//Query

$(function () {
        $("[id*=GVAnganwadi] tr:has(td)").each(function () {
            var tt = $(this).children('td:eq(1)');
            var mm = tt.children(0).val()
            alert(tt.children(0).val());
            tt.children(0).css("background-color", "red");

        });

    });

//table


No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...