Reputation: 51976
<div id='bla'>
<textarea type='text' style='text-align:center; color:black; width:90px; border:1px
solid transparent; font-size:11px; margin:2px'>this is a test</textarea>
</div>
alert($('bla').find('textarea').css('border'))
but for some reason this returns 'undefined' any ideas why? I'm defining a border inside that style... :/
jsfiddle: http://jsfiddle.net/foreyez/yWgqD/
Upvotes: 1
Views: 7686
Reputation: 35407
Missed the ID selector (#
) before bla
...
Instead, use the following:
alert($('#bla textarea').css('border'))
Upvotes: 7
Reputation: 10874
The selector only won't cut it, you forgot the dom ready part too.
$(function() {
alert($('#bla').find('textarea').css('border'));
});
Also as selector this is cleaner
$('#bla textarea')
Upvotes: 0
Reputation: 46077
You need to use the #
ID selector:
$("#bla").find("textarea").css("border");
Upvotes: 2