SO - 30185065
HTML
<div class="container_12" id="action-error"> <span class="error">Error: There was an error deleting your album. Please try again.</span>
</div>
<div class="container_12" id="action-success"> <span class="success">Your album was deleted successfully.</span>
</div>
CSS
div#action-error {
text-align: center;
border: 1px solid white;
display: none;
background-color: #a80077;
border-radius: 15px;
}
/* success div */
div#action-success {
text-align: center;
border: 1px solid white;
display: none;
background-color: #5a8e4a;
border-radius: 15px;
}
JavaScript
if (!RegExp.escape) {
RegExp.escape = function (value) {
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")
};
}
$.urlParam = function (name) {
var path = window.location.href;
//for testing set some other value
path = 'https://jsfiddle.net/h0typaqx/?doc=dd'
var results = new RegExp('[\?&]' + RegExp.escape(name) + '=([^&#$]*)').exec(path);
if (results == null) {
return null;
} else {
return results[1] || '';
}
};
(function ($) {
var doc = $.urlParam('doc');
if (doc) {
if (doc = 'new') {
alert(doc);
}
if (doc = 'new2') {
alert(doc);
}
if (doc = 'new3') {
alert(doc);
}
}
})(jQuery);