I have the following code and I want it to show the div only when the part after the \”?\” includes \”gclid=\”. Note the url could look like xxxxxx.com/?gclid=kljl3j4lk3j4l23
I am not quite sure how to incorporate a partial string search so it only looks for \”?gclid\”
<script type=\"text/javascript\">
$(function(){
if (window.location.search == \"?gclid\") {
$(\'#new\').show();
} else {
$(\'#new\').hide();
}
});
</script>
I am a bit new to this so pardon my ignorance





Rating:
The post javascript – How can I search window.location.search for specific text? appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/javascript-how-can-i-search-window-location-search-for-specific-text.html
No comments:
Post a Comment