JSFiddle - React, Tailwind, and code Playground

by Nibin George

HTML

<div>
    <ul id="testing">
        <li id="first" onclick="openNewBackgroundTab('first')">first</li>
        <li id="second" onclick="openNewBackgroundTab('second')">second</li>
    </ul>
</div>
<script>
    function openNewBackgroundTab(type) {
        debugger;
        var a = document.createElement("a");
        switch (type) {
            case 'first':
                a.href = "http://localhost:25282/UpLoadFile.aspx/";

                break;
            case 'second':
                a.href = "http://www.google.com/";
                break;
        }

        var evt = document.createEvent('MouseEvents');
        evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, true, false, false, false, 0, null);
        a.dispatchEvent(evt);
    }
</script>