/ Published in: JavaScript
                    
                                        
Code from https://snipt.net/geekyjohn/get-url-param/ updated so that most jslint issues are resolved, and updated the return to use a guard condition instead of a separate if statement.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function getUrlParam(name) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
return (results && results[1]) || undefined;
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                