https://codepen.io/st-iv/pen/LBEpzg
After clicking "view: table", you need a check mark instead of the text "Goods in the basket" (for example, this is just the letter V). Tried to make selectors, see what's wrong.
$('.btn_buy').click(function(e){ e.preventDefault(); $(this).html('Товар в корзине').attr('href', '/basket/'); }); $('.view').click(function(e){ e.preventDefault(); $('.goods__item').addClass('view-table'); }); $('.goods__item .view-table .btn_buy').click(function(e){ e.preventDefault(); $(this).html('V').attr('href', '/basket/'); });