Unable to use 'id' selector within if condition - JQuery