
Skip to main content
On click enter redirect to another URL with parameters in javascript
Sometimes you have to redirect user to another URL with parameters (query string) in javascript on click enter button. It also helps you to find the solution to show data with filtered data and redirect user to another URL on click enter button
-
On click enter button visit a URL with parameter using jQuery
HTML Input text
<input type="text" name="query" id="search" value="summer"/>
jQuery CDN with javascript to redirect user to another URL after click on enter button
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $('#search').keypress(function (e) { var query = $.trim($(this).val()); if (e.which == 13) { window.location.href = "/search/all?keyword="+query; return false; } }); </script>
This code snippet will help you to redirect to another URL onclick enter button. It will redirect you to /search/all?keyword=summer URL after getting the value summer from input box on click enter button. This code snippet can be also used to display filtered data using parameter value which is passed as query string to URL.
Bootstrap
Cmd
CodeIgniter
Css
Drupal
Git
Html
Javascript
Jquery
Laravel
Nodejs
Php
Python
Sql
Typescript
Wordpress
Random Code Snippet Queries: Javascript
- How to pass array as arguments to function in javascript
- How to crop multiple images with cropper js
- Json stringify
- How to display for slash as a string in javascript HTML
- How to get file extension using javascript/jquery
- How to echo array in Javascript
- How to add key/value pair to existing form data
- How to validate input type file size in javascript
- Short-circuits conditionals
- How to preview a word document in HTML using javascript
- How to get the length of a number in JavaScript
- Check if value exists in array javascript
- Uncaught TypeError: $(...).summernote is not a function
- Generate 6 digit random number in javascript
- How to fixed bootstrap navbar at top on scroll
- Execute function with condition in javascript
- How to push string in an array in Javascript
- Concat variable with string in javascript
- ReferenceError: $ is not defined
- How to set href value of anchor tag in javascript
- Uncaught TypeError: Illegal invocation
- Javascript to print Fibonacci series upto 15 Observations
- How to check caps lock is on in javascript
- How can I add a key/value pair to a JavaScript object
- Remove property from object in javascript