Reputation: 982
I have some javascript which generates an image encapsulated within an anchor tag. When it renders, the click doesn't work the first time. It does register on the second click on the same element though.
html = '<a href="/product/"><img src="/products/main.jpg"></a>'
$('.nav-search-results').html(html);
Any ideas why this could be happening.
P.S.: the html is actually being generated by a compiled hogan template
template = '<a href="/product/{{{sku}}}"><img src="/products/{{{sku}}}-main.jpg"></a>';
templateCompiled = Hogan.compile(template);
product = {sku: 'SKU-123'}
html = templateCompiled.render(product);
Upvotes: 0
Views: 138
Reputation: 982
Sorry. Wrong question. The problem was with a binding I was placing on this div for a 'change' event. The first click counted as a 'change' event and subsequent click counted as a 'click' event
Upvotes: 0