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
You could use
indexOf()