I am trying to assign a unique Id to my button which is created dynamically this way
This is my code
for (var i = 0; i < response.length; i++) {
var uniqueNumber = new Date().getTime();
var $ordernow = $('<input/>').attr({
type: 'button',
name: 'btn1',
class: 'ordernow btn btn-' + classstyle + '',
value: 'Order Now',
id : uniqueNumber,
style: 'float:right'
});
}
But sometimes i observe that the id that is being genertaed is sometimes same (However this is not happening every time) as shown above
This is the HTML that is generated for the above
<div class="inner-intit">
<input type="button" name="btn1" class="ordernow btn btn-success" value="Order Now" id="1412689973307" style="float:right">
<input type="button" name="btn1" class="ordernow btn btn-success" value="Order Now" id="1412689973307" style="float:right">
</div>
Is there any solution how to recitify this ??
Just for additional information this is how the UI looks for my screen