JQuery - Set all cookies ending with

Posted by Israfel on Stack Overflow See other posts from Stack Overflow or by Israfel
Published on 2010-04-01T08:47:46Z Indexed on 2010/04/01 8:53 UTC
Read the original article Hit count: 140

Filed under:

I'm wondering if it's possible to use a wildcard to select multiple cookies. I'm using jquery to save various scroll position and would like to clear them out in one go. At the moment I clear them out individually as below

    function clearScroll(elementID) {
    if ($.cookie) {
        $.cookie(elementID + '_scrollpos', 0);
    }
}

What I'd like is a clear all something like below.

function clearAllScroll() {
    if ($.cookie) {
        $cookie([name$='_scrollpos'],0);
    }  
}

Is this possible?

© Stack Overflow or respective owner

Related posts about jQuery