I have some string with the hash, after which I need get plantype=chine to satisfied the condition. when I replace the # to & it works fine, but I need to use #
var url = href='//somewebsite/index.html?plan=usa#plantype=china';
var queryString = {};
url.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) {
queryString[$1] = $3;
}
);
if (queryString['plantype'] == 'china') {
// the condition is not satisfied when I use # in a string
}
How to fix it, and what I'm doing wrong?