jQuery解析HTML

The*_*Boy 3 html jquery

我有一个简单的功能,看起来像这样

var getCellText = function ($cell) {
  var html = $cell.html();
  $(html).find("input").each(function () {
    alert(this.value);
  });
}
Run Code Online (Sandbox Code Playgroud)

HTML可能看起来像这样

<input class="lineno" name="lineno" value="4109375" type="hidden">
<input onchange="Time.UpdateLine(this, 'studentno', this.value, '4109375');" class="studentno" value="2088" type="text">
Run Code Online (Sandbox Code Playgroud)

我需要获取studentno输入标记的值(我可以忽略名为lineno的输入).

我怎么能这样做,正如你所看到的,我已经试过了

Mat*_*all 7

你的事情太复杂了.不要使用.html(),请使用.val().

function getCellText($cell)
{
    var value = $cell.find('input.studentno').val();
    console.log(value);
}
Run Code Online (Sandbox Code Playgroud)