私は自分のウェブサイトの検索機能を作成しようとしています。アイテムのインデックスを選択する際に問題が発生しただけです。jQueryでインデックスを使用して要素を検索する
$(document).on('keyup', '.inputs input', function (event) {
var $inputVal = $(this).val();
var $inputListVal = $(this).closest('tr').find('input').index(this);
var $trList = $(this).parent().parent().parent().children();
$.each($trList, function(index) {
if (!$(this).hasClass('inputs') && !$(this).hasClass('first-item')) {
var tdList = $(this).children().index($inputListVal); <!-- This is whats not working ATM -->
console.log(tdList);
};
});
});
質問1:なぜそれが働いていない上の任意のアイデア
これは私がATMを持って何ですか?
質問2:どのように私はそれの検索側を行うだろうか?例えば彼らがpi
を入力すると、2文字(パイ、豚など)から始まるすべてのものが表示されますか?
<tr class="inputs">
<th><input id="tick-all" type="checkbox" name="tick" value="download"></th>
<th><input class="small-input" type="text" name="box_number"></th>
<th><input class="md-input" type="text" name="client_name"></th>
<th><input class="md-input" type="text" name="make"></th>
<th><input class="small-input" type="text" name="qty"></th>
<th><input class="big-input" type="text" name="descnption"></th>
<th><input class="small-input" type="text" name="width"></th>
<th><input class="small-input" type="text" name="depth"></th>
<th><input class="small-input" type="text" name="height"></th>
<th><input class="md-input" type="text" name="colour"></th>
<th><input class="md-input" type="text" name="order_number"></th>
<th><input class="md-input" type="text" name="quality"></th>
<th><input class="big-input" type="text" name="picture"></th>
<th><input class="small-input" type="text" name="Order"></th>
</tr>
<?php
require_once('connent.php');
$sql = "SELECT * FROM client_info";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td><input type='checkbox' name='download-tick' value='download'></td>";
echo "<td>".($row['Box'])."</td>";
echo "<td>".($row['Client'])."</td>";
echo "<td>".($row['Make'])."</td>";
echo "<td>".($row['Descnption'])."</td>";
echo "<td>".($row['Width'])."</td>";
echo "<td>".($row['Depth'])."</td>";
echo "<td>".($row['Height'])."</td>";
echo "<td>".($row['Colour'])."</td>";
echo "<td>".($row['OrderNo'])."</td>";
echo "<td>".($row['Quality'])."</td>";
echo "<td>".($row['Picture'])."</td>";
echo "<td>".($row['Order'])."</td>";
echo "<td>23<br><input class='small-input' type='text' name='Order'></td>";
echo "</tr>";
}
//echo $count = mysqli_num_rows($result);
?>
我々は問題を再作成することは困難になるうちのhtmlの詳細を –
を確認することができるようにあなたは私がの両方をしようと試みてきたPlunker –