<div class="b-filter__field" id="sort_selector"> {%if $get == "t"%}<span>{%else%}<a href="" data-value="t">{%/if%}По популярности{%if $get == "t"%}</span>{%else%}</a>{%/if%} {%if $get == "v"%}<span>{%else%}<a href="" data-value="v">{%/if%}По времени публикации{%if $get == "v"%}</span>{%else%}</a>{%/if%} {%if $get == "r"%}<span>{%else%}<a href="" data-value="r">{%/if%}По рейтингу{%if $get == "r"%}</span>{%else%}</a>{%/if%} </div> <script> $(document).ready(function(){ $("#sort_select").bind("click", function(e){ e.preventDefault(); var v = $("a").data('value'); console.log(v); // Он даже не доходит до сюда, а по ссылке все равно переходит. var loc = location.href + "&sort=" + v; document.location.href = loc; }); }); I want a click to add a get parameter to the link, but I cannot get the value of the user attribute. Tell me, what is the error?
id="sort_selector, and you use$("#sort_select")- Andrew B