0

I am using this code to display tabs in url so i need question mark instead of hashtag e.g www.shopping.com/gifts?h=tab1 (the link should be look like this)

$(function(){
  var hash = window.location.hash;
  hash && $('ul.nav a[href="' + hash + '"]').tab('show');

  $('.nav-tabs a').click(function (e) {
    $(this).tab('show');
    var scrollmem = $('body').scrollTop() || $('html').scrollTop();
    window.location.hash = this.hash;
    $('html,body').scrollTop(scrollmem);
  });
});
  • You can take the solution from here https://stackoverflow.com/questions/5999118/how-can-i-add-or-update-a-query-string-parameter and then use `history.replaceState()` or `history.pushState()` in order to change the URL without reloading the page completely. – Constantin Groß Nov 05 '17 at 16:07
  • Thanks! Can you paste here proper code... which will work so i can test it... – Talha chaudhry Nov 05 '17 at 16:12
  • Sorry, but Stack Overflow is not a coding service, and I'd rather prefer using my free time to help with specific problems, not providing complete solutions. – Constantin Groß Nov 05 '17 at 16:14
  • Correct but i don't understand you solution...i am just asking for solution... – Talha chaudhry Nov 05 '17 at 16:21

0 Answers0