Search Results

Search found 2 results on 1 pages for 'betacar'.

Page 1/1 | 1 

  • jQuery val() undefined

    - by betacar
    We have the following XHTML table: <tr class="encabezado"> <th scope="col" width="2%">1</th> <th scope="col" width="2%">2</th> <th scope="col" width="2%">3</th> <th scope="col" width="2%">4</th> <th scope="col" width="2%">5</th> <th scope="col" width="2%">...</th> <th scope="col" width="2%">31</th> </tr> <tr> <th scope="row">Area 1<input name="line_config" type="hidden" value="0,5,50" /></th> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt">...</td> <td class="gantt"> </td> </tr> <tr> <th scope="row">Area 2 <input name="line_config" type="hidden" value="0,0,10" /></th> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt">...</td> <td class="gantt"> </td> </tr> When there is a click over a TD.gantt element, we want jQuery to get the value from input[name='line_config'] tag. We try the following jQuery code, but val() returned 'undefined': $(document).ready(function() { function sum_day(tag, status, column) { var total_day = 0; var index_pos = 0; var values = 0; values = tag.closest('tr').children("input[name='line_config']").val(); alert(values); //Return undefined return total_day; } $('td.gantt').click(function() { var gantt_tag = $('td.preop'); $(this).toggleClass('preop'); sum_day(gantt_tag, 'preop', $(this).index()); }); }); Are we getting right the value way? If anyone can help us, we appreciate... =)

    Read the article

  • jQuery: Getting value from input array

    - by betacar
    We have the following form: <form> ... <table width="100%" cellspacing="0" class="datagrid_ppal"> <tbody> <tr> <th scope="row">Area 1 <input name="config_line" type="hidden" value="0,5,50" /></th> <td class="gantt"> </td> <td class="gantt"> </td> <td class="gantt"> </td> ... </tr> </tbody> </table width="100%" cellspacing="0" class="datagrid_ppal"> ... <form> What we need is to get the first, second or third from the hidden input value. We have tried this and didn't work: var value = $('th').children('input:hidden').val(); Can anyone help us? We would really appreciate it.

    Read the article

1