Good morning, I have this kind of board,
<table id="table" class="table table-hover">
<thead>
<tr>
<th style="text-align:left;">Titulo del documento</th>
<th style="text-align:left;">Acronimo Proyecto</th>
<th style="text-align:left;">Estado</th>
<th style="text-align:left;">Idioma</th>
<th style="text-align:left;">Nº del documento</th>
<th style="text-align:left;">Versión</th>
<th style="text-align:left;">Revisión</th>
<th style="text-align:left;">Descripción</th>
<th style="text-align:left;">Fecha</th>
<th style="text-align:left;">Acronimo Subcategoria</th>
<th style="text-align:left;">Confidencialidad</th>
<th style="text-align:left;">Tipo de documento</th>
<th style="text-align:left;">Usuario</th>
<th style="text-align:left;">Aprobado por</th>
<th style="text-align:left;">Autorizado por</th>
<th style="text-align:left;">Revisor</th>
<th style="text-align:left;">Compañia</th>
<th style="text-align:left;">Codigo proyecto</th>
<th style="text-align:left;">Edición</th>
<th style="text-align:left;">Eliminar</th>
</tr>
</thead>
<tr>
<td>Prueba 1</td>
<td>ACR</td>
<td>Aprobado</td>
<td></td>
<td>12</td>
<td>1</td>
<td>1</td>
<td>Prueba</td>
<td>2017-05-09</td>
<td>COR</td>
<td>E</td>
<td>RPT</td>
<td>ACD</td>
<td>ACD</td>
<td>ACD</td>
<td>ACD</td>
<td>DAU</td>
<td>Prueba 1-RPT-DAU-COR-ACR-2017-</td>
</table>
In which it shows results obtained from a Select * of a BBDD. I want to add a search engine with Jquery to be totally dynamic, but at the time of adding it I was looking for the forum and "supposedly" would be like a generic code, and the truth of Jquery I understand almost nothing. It would be this.
<script>
$("#search").keyup(function () {
_this = this;
// Show only matching TR, hide rest of them
$.each($("#table tbody tr"), function () {
if ($(this).text().toLowerCase().indexOf($(_this).val().toLowerCase()) === -1)
$(this).hide();
else
$(this).show();
});
});
</script>
But when it comes to testing the search engine does not work
The search engine I have it out of the table, I say this because I do not know if it is correct.
<input type="text" id="search" placeholder="Type to search..." />
P.D. Jquery library is well inserted since I have another option designed in Jquery that generates a code automatically in otor input but the "ID" are not the same.
Even so, this code does not think it is generating conflicts, no?
$(document).ready(function () {
$('#titulo_documento, #compania1, #acro_subcategoria, #acro_proyecto, #fecha, #idioma, #acro_documento, #proyecto, #estado, #num_documento, \n\
#version, #revision, #descripcion, #confidencialidad, #acro_usuario1, #aprobado_por1, #autorizado_por1, #revisor1').blur(function () {
$('#codigo_proyecto').val($('#titulo_documento').val() + "-" + $('#acro_documento').val() + "-" + $('#compania1').val() + "-" + $('#acro_subcategoria').val() + "-" + $('#acro_proyecto').val() + "-" + $('#fecha').val() + "-(" + $('#idioma').val() + ")");
});
});
function change_documento()
{
var acro_documento = $("#acro_documento").val();
$.ajax({
type: "POST",
url: "subcategoria.php",
data: "acro_documento=" + acro_documento,
cache: false,
success: function (response)
{
//alert(response);return false;
$("#acro_subcategoria").html(response);
}
});
}