I have a form generating dynamic cookie, say:
webform-62[1234356]
62[1234356] can be any number. I need to check if cookie with name starting with “webform-” exists using some wildcard check. Below is not working
if( $.cookie('webform\\S*') == null ) {
alert('no cookie');
}
Any hint would be very much appreciated.
Thanks.
Use this:
document.cookiecontains a list of cookies on the current domain/path in the following format:<cookie-name>=<cookie-value>(each name=value pair is separated by a;).So the given code just searches for a cookie with a name of the form
webform-\S*in this list. The search call returns a number upper than or equal to 0 if the cookie is found.