The reason your first example isn't working is because of a typo:
$(".sidebar").css({'height':($(".content").height()+'px'});
should actually be
$(".sidebar").css({'height':($(".content").height()+'px')});
you're missing a trailing bracket from before the .content selector.