🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Filtering and sorting search results in an HTML page

Step:1 – Create first html page. with any name example(search.html)

Step:2 – Create a second Html page.with any name example(page-one.html)

Step:3 Then create a json page like that (data.json).

let Start to crate html page: Step:1

// ALL this url put the after title tage
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
// Put this code in the body
<div class="container">
<div class="row">
<div class="col-2"></div>
<div class="col-8">
<div class="card">
<h5 class="card-header">Search only html page and content</h5>
<div class="card-body">
<p class="card-text">
<div class="form-group">
<label class="sr-only">Search:</label>
<input class="form-control" type="text" onfocus="this.value=''"
placeholder="search keyword.." name="search" id="search"
style="border-color:forestgreen; border:2px solid blue; border-radius: 25px;">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp;</input>
<ul class="list-group" id="result"> </ul>
</div>
</p>
</div>
</div>
</div>
<div class="col-2"></div>
</div>
</div>
view raw body hosted with ❤ by GitHub
// Put this code befor end of the body tag
<script>
$(document).ready(function () {
$.ajaxSetup({ cache: false });
$('#search').keyup(function () {
$('#result').html('');
$('#state').val('');
var searchField = $('#search').val();
var expression = new RegExp(searchField, "i");
$.getJSON('data.json', function (data) {
$.each(data, function (key, value) {
if (value.name.search(expression) != -1 || value.location.search(expression) != -1) {
$('#result').append('<li class="list-group-item link-class"> <a href="' + value.location + '" target="_blank"> ' + value.name + ' </a></li>');
}
});
});
});
$('#result').on('click', 'li', function () {
var click_text = $(this).text().split('|');
$('#search').val($.trim(click_text[0]));
$("#result").html('');
});
});
</script>
view raw jscript hosted with ❤ by GitHub

After save this page and run on the browser it will look like this.

Step:2– Then create second page of html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>page one </title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-2"></div>
<div class="col-8"> <div class="card text-center">
<div class="card-header">
Best Hospital in the world
</div>
<div class="card-body">
<h5 class="card-title">Special treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Apply Appoinment</a>
</div>
<div class="card-footer text-muted">
24X7
</div>
</div> </div>
<div class="col-2"></div>
</div>
</div>
</body>
</html>

Step:3– Then create the data json page (data.json)

[
{
"name":"hopital" ,
"location":"page-one.html"
},
{
"name":"Top ten hospital in world" ,
"location":"page-one.html"
},
{
"name":"Best hospital in world" ,
"location":"page-one.html"
},
{
"name":"New hospital in world" ,
"location":"page-one.html"
},
{
"name":"Cancer hospital in world" ,
"location":"page-one.html"
},
{
"name":"hospital in world 2020" ,
"location":"page-one.html"
}
]
view raw data.json hosted with ❤ by GitHub

And finally we can search page whatever put the keyword name.

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.