In your event handler, this
is the element which triggered the event. You could do something like this:
function resizeInput($theInputField) {
var inputWidth = $theInputField.width();
if(inputWidth < 400){
$theInputField.attr('size', $theInputField.val().length);
}
}
$('#question-list').on('keyup', '.question', function(){
resizeInput($(this));
});