开发者

How do i get the height of the input?

I'm using jquery to add a plugin to a input field. How to I get the height?

$("#age").myownplugin();

<input type="text" id="age" />

and inside myownplugin i've tried

alert( $(this).height )

withou开发者_开发问答t the result.


You can use these methods:

height + padding + border:

$(this).outerHeight() 

.

height + padding + border + margin:

$(this).outerHeight(true) 


height is a method: $(this).height();


i don't know about your plugin structure, but height is a method so you have to use it like a method :).
for example-if you try this in your js, you will get the height of input box.

$('#age').height();


You can use $(elem).attr("height") too.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜