Setting a cookie based on the name of the link that is clicked

后端 未结 4 605
一个人的身影
一个人的身影 2021-01-13 16:28

TLDR When clicking on a link I want to assign a cookie with a name of instrument and a value of the text on the link clicked.

Using Jquery.1.4.2.min

4条回答
  •  感动是毒
    2021-01-13 16:47

    var value = $(this);
    

    will assign the jQuery object to value. Use

    var value = $(this).text();
    

    or

    var value = $(this).attr('href');
    

提交回复
热议问题