0
<script type="text/html" id="marketSelection">
        <h3 class="choose-store">Choose your store:</h3>
        <div class="text-center">
            <% _.each(suppliers, function (supplier) { %>
            <button class="btn-custom supermarket-item" data-id="<%= supplier.id %>">
                <i></i><%= supplier.name %>
            </button>
            <% }) %>
        </div>

        /*File:src/js/data.js*/
        var cookie_selectedSupermarket = CookieManager.retrieve('supplierId'),
            cookie_selectedPostalCode = CookieManager.retrieve('deliveryareaCode'),
            cookie_q = CookieManager.retrieve('q');
        Data = {
            availabilityList: [JSON_STORE_AVAILABILITY_LIST],
            postalCodes: [JSON_POSTAL_CODES],

            hardCode: {
                selected_supermarket: null,
                selected_postal_code: null,
                q: null
            },
            query: {
                selected_supermarket: Utils.getQueryParameterByName('selected_supermarket'),
                selected_postal_code: Utils.getQueryParameterByName('selected_postal_code'),
                q: Utils.getQueryParameterByName('q')
            },
            cookie: {
                selected_supermarket: cookie_selectedSupermarket ? cookie_selectedSupermarket.value : null,
                selected_postal_code: cookie_selectedPostalCode ? cookie_selectedPostalCode.value : null,
                q: cookie_q ? cookie_q.value : null
            },

            PROTOCOL: 'https://',
            DOMAIN: 'www.test.com.au',
            PATH: '/',
            redirectURI: '/all-products/?supplier=<%= supplierId %><% if (q) { %>&q=<%= q %><% } %>'
        };

I have an issue having the buttons open in new tab. In HTML - I know we have to add in _blank but for cases like this, what is the solution?

Thanks

EDIT: Added in more codes so that it's more clear what I want.

user2320517
  • 261
  • 1
  • 4
  • 14
  • Why is there an ``? Is this a template? (where is the ``?) And most importantly: in the code you're showing the generated buttons will do nothing. They're just inert markup. Where's the part that actually makes them supposed open things? – Mike 'Pomax' Kamermans Jun 01 '15 at 04:19
  • I've added in more code hoping you guys can figure it out. It's my company's website. It's not my duty nor am I an expert in doing this but we want this to be changed asap so I'm taking charge. Thanks – user2320517 Jun 01 '15 at 04:31
  • that's fairly broken code. How are you starting a new ` – Mike 'Pomax' Kamermans Jun 01 '15 at 04:36
  • Is there a particular code that deals with the issue? It's bit too long so I'm not posting the whole code... – user2320517 Jun 01 '15 at 04:54
  • don't post "the whole code", but do post "code that is well formatted, balanced, and a *working example* of what you have". So you remove all the HTML bits that don't contribute, but that still means making sure all the tags etc. are balanced – Mike 'Pomax' Kamermans Jun 01 '15 at 15:55

1 Answers1

1

You can use Javascript

function openTab(url) {
  var win = window.open(url, '_blank');
  win.focus();
}
PhuLuong
  • 527
  • 4
  • 11