Select functionality, moved js to new function

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>