0

For example there is a website www.example.com with 5 div html elements in it. And when someone adds ?show=true to www.example.com url, the sixth div appears on website (5 old div's and new one).

Is this possible with JS or jQuery?

EDIT: I have this code but it's not working in my example:

<script>
    window.onload = function () {
        var url = document.URL;
        var pattern = /group=.*/;
        var res = pattern.exec(url);
        res = res.toString();
        var tab = res.split("=");

        if (tab[0] == "group" && tab[1] != "") {
            var id = tab[1];
            var div = document.getElementById(id);
            if (div) {
                div.style.display = "block";
            }
        }
    }
</script>

<div class="category" id='category-name' style="display:none;">

and when I add /?group=category-name in url, this new div with id category-name is not showing

Johan
  • 74,508
  • 24
  • 191
  • 319
Davor Budimir
  • 386
  • 2
  • 4
  • 15

0 Answers0