开发者

JQuery: Attaching input form to input field in datepicker style

开发者 https://www.devze.com 2023-03-23 09:12 出处:网络
I want to display an input form attached to an input field like the datepicker does. I\'ve tried the \"show\" function, but instead of displaying the input form overlaid, it shows what was hidden and

I want to display an input form attached to an input field like the datepicker does.

I've tried the "show" function, but instead of displaying the input form overlaid, it shows what was hidden and moves the rest of the page down.

There are many overlay l开发者_C百科ibraries out-there, but none (that I've seen) attaches the overlaid form to the input field, like the "datepicker" does.

Is there a simple way to accomplish this? (preferably no other external libraries, other than jQuery or jQuery UI).

Thanks!


The problem you're having is CSS related.

Just apply some absolute positioning on the DIV you're showing via .show().

Example :

// jQuery is :
$('#yourDiv').addClass('yourDivClass');

/* CSS is : */
.yourDivClass {
  position: absolute;
  top: 50px;
  left: 100px;
}

Adjust left and top values to your likings.


As far as I know, there is no library or plugin for this (correct me if I'm wrong). You should use CSS absolute positioning for the form, and set the top/left properties on the form to the offset of the input field. Here is a quick example of how I'd do it: http://jsfiddle.net/85ZkV/

0

精彩评论

暂无评论...
验证码 换一张
取 消