converted native JS to jQuery