KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a getter to get the value from a cookie. Now I have 2 cookies by the name shares= and by the name obligations= . I want to make this getter only to get the values from the obligations cookie. How do I do this? So the for splits the data into separate values and puts it in an array. function getCookie1() { // What do I have to add here to look only in the "obligations=" cookie? // Because now it searches all the cookies. var elements = document.cookie.split('='); var obligations= elements[1].split('%'); for (var i = 0; i < obligations.length - 1; i++) { var tmp = obligations[i].split('$'); addProduct1(tmp[0], tmp[1], tmp[2], tmp[3]); } }
Tags (comma-separated)
Save Edits
Cancel