My Jade template -
input#main_search.span2(
    style = 'height: 26px; width: 800px;' ,
    type = 'text',
    readonly='true',
    name='searchBar',
    value='test'
)
JS file -
$('#searchBar').val('hi')
console.log('sup')
Console output -
sup
But searchBar value stats at test. What am I doing wrong?
You can simply use the jQuery val() method to set the value of an input text box.
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
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With