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..

    CakePHP: How to use PHP to dynamically use a CSS property type in an MVC framework

    How to use a hover css pseudo to apply only to the top level element?

    How to Use jquery Animate() with .slideToggle() Between Two Classes

    how to write a css that only can be visible on desktop in bootstrap

    How to overlap images in the header section?

    How to apply multiple css transform properties using Jquery

    How to set the maximum height of CSS images?

    How do I fix the image size when changing to another image?

    How can I get a div just inside an input at 0% and 100%?

    css in firefox and ie is rendering old css file…chrome shows new css just fine

    What is the purpose of this csslint error and how can I get rid of it?

    CSS Syntax - How to interpret this?

    How to make width of a dynamic table not increase?

    How to properly use css will-change property?

    How to force span to use parent font-family in CSS

    How to get the real font name of a div on a web page when it set css font-family?

    How to get Facebook Like Box “Dark Scheme” to work correctly? (Background is transparent.)

    How to use a different CSS stylesheet if a user has JavaScript disabled in their browser?

    Jquery Mobile dynamic thumbnail list-How to create a border?

    How to center divs on page

    How to style this with css? [closed]

    How to get css background color on tag to span entire row

    How can I get the text style from window.selection()?

    How can I get my drop-down to not open unless the li is hovered?

    How to increase or decrease space between two lines in same paragraph?

    How to center div within another div?

    Show different button on page load via Jquery

    How to give the padding for option with css only

    How to add spacing between two rows of multiple divs each

    How do I line up CSS elements? Is there a tool I can use?