开发者

How do i get the height of the input?

开发者 https://www.devze.com 2023-03-14 13:30 出处:网络
I\'m using jquery to add a plugin to a input field. How to I get the height? $(\"#age\").myownplugin();

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

精彩评论

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