Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/07/2015, 18:57
jjjtaccess
 
Fecha de Ingreso: junio-2015
Ubicación: Venezuela
Mensajes: 6
Antigüedad: 8 años, 9 meses
Puntos: 0
De acuerdo Respuesta: Filtrar por Input text

Solucionado Gracias a la ayuda de XVE aca el resultado

Código HTML:
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Jefferson Jimenez</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
 
    <link rel='stylesheet prefetch' href='http://s.cdpn.io/3/bootstrap.min.css'>
</head>
 
<body>
<section class="container">
 
	<h2>Tabla Filtrar</h2>
 
	<input type="button" onClick="filtraCantidad();" value="filtra">
 
	<table name="datos" class="order-table table">
		<thead>
			<tr>
				<th>Name</th>
				<th>Email</th>
				<th>Phone</th>
				<th>Price</th>
		       </tr>
		</thead>
		<tbody id="datos">
			<tr>
				<td>John Doe</td>
				<td>[email protected]</td>
				<td>0123456789</td>
				<td>99</td>
				<td><input type="text" name="Cantidad" id="Cant1" value=""></td>
			</tr>
			<tr>
				<td>Jane Vanda</td>
				<td>[email protected]</td>
				<td>9876543210</td>
				<td>349</td>
				<td><input type="text" name="Cantidad" id="Cant2" value=""></td>
			</tr>
			<tr>
				<td>Alferd Penyworth</td>
				<td>[email protected]</td>
				<td>6754328901</td>
				<td>199</td>
				<td><input type="text" name="Cantidad" id="Cant3" value=""></td>
			</tr>
			<tr>
				<td>Jefferson</td>
				<td>[email protected]</td>
				<td>041456545454</td>
				<td>125</td>
				<td><input type="text" name="Cantidad" id="Cant4" value=""></td>
			</tr>
 
		</tbody>
	</table>
 
</section>
 
<script>
function filtraCantidad()
{
	// la var para recorrer la tabla
	var tableReg = document.getElementById('datos');
	// la var para pasar el input donde deseo hacer match
	var x = document.getElementsByName("Cantidad");
 
	for(var i = 0; i < x.length; i++)
	{ // Recorremos todas las celdas
		// Comparo sea tipo input text
		if (x[i].type == "text")
		{
			console.log(x[i].value);
			// Verifico el valor del input
			if (x[i].value == null || x[i].value.length == 0 || x[i].value=="" || /^\s*$/.test(x[i].value))
			{ // Si esta vacio oculto el display
				console.log(i);
				tableReg.rows[i].style.display = 'none';
			} else { // caso contrario lo hago visible
				tableReg.rows[i].style.display = '';
			}
		}
	}
}
</script>
 
</body>
</html>