converting jQuery to JavaScript