You are logging sup
directly which is a string
console.log('sup')
Also you are using the wrong id
The template says #main_search
but you are using #searchBar
I suppose you are trying this out
$(function() {
var sup = $('#main_search').val('hi')
console.log(sup); // sup is a variable here
});