Changed type checks to jQuery’s