This is because if the price of such good rises, there is no good the consumers can switch to as a substitute so the demand of such good is inelastic/elastic. For example cooking salt will have an inelastic/elastic demand if the price of cooking salt increases, because there is no exact substitute good for a cooking salt.