Reputation: 51
I am making some site for personal use. I am trying to make some search bar, box. But, all that I found is with PHP. I do not want PHP search box, I want something like Ctrl+G or Ctrl+H (Like "Find words in this site"). I want to make search bar for only text in active site,page. Without PHP. W3S is helping only with PHP. If You know what I mean, please respond fast. Sorry for my bad English. ;) Thank You!
I tried search codes in Google and did not find how to make search box without PHP.
eg. CTRL+G or CTRL+H I do not have code.
This is my first question on stackoverflow, sorry for mistakes.. I expect to work only in that site that is code in.(Again, sorry for English)
Upvotes: 0
Views: 59
Reputation: 447
Any search box that you are creating to get data or information from your site will be using php because it is more then likely in most cases pulling data from your database if you are trying to replicate the default browser functionality for Ctrl+F then you can create a search box with html and JavaScript
Heres a little snippet to send you on the right path
jQuery(document).keydown(function(event) {
// If Control or Command key is pressed and the F key is pressed
if((event.ctrlKey || event.metaKey) && event.which == 70) {
// hide/unhide search box
//or put your custom code here
//Insert code above this line
event.preventDefault();
return false;
}
}
);
<form action="#">
<input type="text" id="search" placeholder="search">
<input type="submit">
</form>
Upvotes: 2