Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js get location search parameter

// Example URL: "https://codepen.io/pen/?editors=0012&debug=true"
const params = new URLSearchParams( location.search ); // Get the ?editors=12 part

let editors = params.get("editors");  // Parse the parameters
console.log( editors ); // === "0012"
console.log( params.get("debug") ); // === "true"
 
PREVIOUS NEXT
Tagged: #js #location #search #parameter
ADD COMMENT
Topic
Name
8+9 =