2016-04-15 63 views
0

我在屏幕上动态地创建了一些控件,并且我想为数字字段使用jQuery UI微调控件。我使用绝对定位我的元素,但它似乎不适用于UI控件。我用两个控件的例子创建了一个jsfiddle。绝对控制不起作用。在绝对定位元素中使用jQuery UI微调控件

https://jsfiddle.net/41u0kjsb/

<input type="text" style="height:18px;width:40px;top:55px;left:255px;position:absolute;z-index:101;font-family:Arial;font-size:10pt;text-align:right;padding-right:2px;" pt_properties="biu" pt_format="" pt_mask="" pt_readonly="False" pt_required="False" pt_dmn="QTY_FURN_100M" pt_type="N_NUMERIC" title="qty_furn_100M (QTY_FURN_100M)" tabindex="1" id="control1" maxlength="255" value="1"> 
<br><br><br> 
<input type="text" style="height:18px;width:40px;position:relative;z-index:101;font-family:Arial;font-size:10pt;text-align:left;padding-right:2px;" pt_properties="biu" pt_format="" pt_mask="" pt_readonly="False" pt_required="False" pt_dmn="QTY_FURN_100M" pt_type="N_NUMERIC" title="qty_furn_100M (QTY_FURN_100M)" tabindex="1" id="control2" maxlength="255" value="1"> 

    $('input[PT_TYPE="N_NUMERIC"]').spinner(); 

回答

0

不要设置在插件的位置。相反,将其设置在微调的包装已被创建后:

<input id="spin" style="position:relative;"> 

然后:

​​

例如:https://jsfiddle.net/3rf0xhqr/

+0

真棒...谢谢。 –

相关问题