Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p class="lead">Add a "?q=XXXX" at the end of the URL and you will see the value here.</p>
- <b>Value: <span id="insert-value">UNDEFINED</span></b>
- </br></br></br>
- I would rather the value in the input and disappear when you click the input</br>
- <input type='text' name='q' id='searchthat' class='custom_input_inside message'>
- <script src="jquery-3.4.1.min.js"></script>
- <script src="https://code.jquery.com/jquery-3.2.1.slim.js"/></script>
- <script>
- !(function (e) {
- e.extend({
- uriGet: function () {
- var e = location.href,
- t = new URL(e),
- n = t.searchParams.get(arguments[0]);
- return n;
- },
- });
- })(jQuery);
- $( document ).ready(function() {
- var a = $.uriGet('q');
- $('span#insert-value').html(a);//if you change that to input it wont work. I want it to triggure in the input field only would be better if it will by css in the input
- let inputEle = $("#searchthat");
- inputEle.val(a);
- inputEle.on("focus",function(){
- inputEle.val("");
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement