How to hide text present inside search box?


Tags: javascript,css,tampermonkey

Problem :

I have set a bookmark which has -adult word to search query, so that inappropriate results won't show up. Now, how do I hide -adult present in the search box?

Example:

youtube screen capture

My idea so far:

To use CSS to hide it then make another textbox to be seen, then add a few event handlers to sync the real search box with my fake search box.

comments by @wOxxOm

that's tricky to implement I suppose since google uses ajax and events, but probably it'll be possible to set a document mutation observer which will hide the stuff in the search box before it's shown

If the above method is not possible, then please suggest alternative for solving this problem.



Solution :

Remove -adult from the field and append it on the button click event. Example:

var keywordInput = $('input[name="-adult"]');
$('input[name="SearchButton"]').click(function() {
  window.location = 'http://example.com?kwd=' + encodeURIComponent(keywordInput.val());
});

    CSS Howto..

    How to display a list in horizontal groups of li elements?

    How to enqueue second stylesheet in Wordpress child theme?

    How Do I Add CSS Transition Effect to This

    how the highlighted text color and background is determined

    Navbar doesn't scroll to show links on smaller devices when using nicescroll plug-in

    How to set link visited color in JQuery

    How to detect mouse is over a child element in jQuery?

    How to dynamically modify