Vanko Vanko - 6 months ago 45
Javascript Question

multiple fields with jQuery Wan Spinner Plugin

I would like to create a table with input fields using this pluggin(or similar):

Number Picker pluggin

In the demo if I simply add:

<div class="wan-spinner wan-spinner-4">
<a href="javascript:void(0)" class="minus">-</a>
<input type="text" value="1">
<a href="javascript:void(0)" class="plus">+</a>
</div>


the newly added item is not working. So I'm adding new line:

$(".wan-spinner-4").WanSpinner({inputWidth: 100}).css("border-color", "#C0392B");


And everything is working for the new item.

So if there is a table with 100 rows - should I generate 100 rows:

$(".wan-spinner-4").WanSpinner({inputWidth: 100}).css("border-color", "#C0392B");


or there is a generic solution for this.

Answer

Ok, since loop is server side you just need to wait document ready

$(document).ready(function(){ 
   $(".wan-spinner-4").WanSpinner({inputWidth: 100}).css("border-color", "#C0392B"); 
})
Comments