Having some trouble with my Javascript and CSS. The script is functioning well, but when I use the filtering function, the CSS stops working and only the filtered results are displayed on the HTML page. Looking for advice on how to fix the Javascript.
<script>
var createTable = function(){
var street = document.getElementById("search-street").value;
var suburb = document.getElementById("search-suburb").value;
var pc = document.getElementById("search-pc").value;
var type = document.getElementById("search-type").value;
var counter=0;
if (street == '' && suburb == '' && pc == '' && type == '') {
for(i=0;i<myArray.length;i++){
var id = myArray[i][4];
if(counter%3==0){
document.write("<div class='row'>");
}
document.write("<div class='col-sm-6 col-md-4'>");
document.write("<div class='thumbnail'>");
document.write("<div class='caption'>");
document.write("<p>" + myArray[i][3] + "</p>");
document.write("<p><a href='edit_property.php?id="+id+"' class='btn btn-default' role='button'>Edit</a> <a href='#delete_property.php?id="+id+"' class='btn btn-danger' role='button'>Delete</a></p>");
document.write("</div>");
document.write("</div>");
document.write("</div>");
counter++;
if(counter%3==0){
document.write("</div>");
}
}
} else {
for(i=0;i<myArray.length;i++){
var id = myArray[i][4];
if(counter%3==0){
document.write("<div class='row'>");
}
if(street==myArray[i][0] || suburb==myArray[i][1] || pc==myArray[i][2] || type==myArray[i][3]){
document.write("<div class='col-sm-6 col-md-4'>");
document.write("<div class='thumbnail'>");
document.write("<div class='caption'>");
document.write("<p>" + myArray[i][3] + "</p>");
document.write("<p><a href='edit_property.php?id="+id+"' class='btn btn-default' role='button'>Edit</a> <a href='#delete_property.php?id="+id+"' class='btn btn-danger' role='button'>Delete</a></p>");
document.write("</div>");
document.write("</div>");
document.write("</div>");
counter++;
}
if(counter%3==0){
document.write("</div>");
}
}
}
}
createTable();
</script>