<td>sss<input type="hidden" value="aaa"/></td>怎么取sss

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    </head>
    <body>
        <table>
            <tr>
                <td>
                    sss<input type="hidden" value="aaa" />
                </td>
            </tr>
        </table>
        <script type="text/javascript">
            var textVal = $('td')[0].firstChild.nodeValue;
            alert(textVal.trim());
        </script>
    </body>
    </html>
      

  2.   

      alert(  $("td").contents().filter(function() { return this.nodeType == 3; }).eq(0).text());
      

  3.   

    $("type='hiddle'").praentNode.innerHTML