ASKER
ASKER
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script>
$(function(){
$(document).ready(function(){
$("#searchname").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#wrapper .empcard").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
});
</script>
</head>
<body>
<input type="text" id="searchname" value="">
<div id="wrapper">
<div id="1" class="empcard"><div>Francis Smith</div>
<div>15/09/1963</div>
<div>HR</div></div>
<div id="2" class="empcard">Frank Doogle</div>
<div id="3" class="empcard">Alan Smith</div>
<div id="4" class="empcard"><div>Diane Smith</div>
<div>IT</div></div>
<div id="5" class="empcard">Francis Cotton</div>
</div>
</body>
</html>
Super thanks... that was it.ASKER
ASKER
ASKER
if (!$(this).val()){
console.log("FIELD EMPTY");
var searchdivs = document.getElementsByClassName("empcard");
for(var i = 0; i < searchdivs.length ;i++)
{
searchdivs[i].style.display = "none";
}
}
else
{
console.log("stuff in there");
}
ASKER
ASKER
ASKER
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
ASKER
I do have an issue with it which that it is ONLY displaying that part of the DIV and not the entire div.
So in effect I have an employee card
Francis Smith
14/06/1973
HR
Grade C
When I do the search the DIVs become super simple and return just a single line of
Francis Smith.
So how can I change this code to display the entire DIV as originally displayed from <div> to </div> and not just the text matching element?
Nearly there.. excellent thank you
R