I assume that this is a web graphic that you have created, as you are giving your dimensions in pixels. Web graphics do not have to be 300dpi - they should be 72dpi. What is happening when you export at 300dpi is that your image size is being increased by roughly four times (300 ÷ 72 = 4.166 x 238px gives you 991px.
When viewed at 100%, a 72dpi image at 238px should not be blurry - it's only if you start zooming in that you will see degradation. Having said that, Indesign's jpg export is not the best - it might be better to export as a PDF and open that in Photoshop and export to jpg from there.
I have tried exporting to PDF first, but still it is noticeable how blurry and pixelated the image is...
Also, I tried to change the resolution in Photoshop, but the result is still worse than 300ppi with 992px size.
Is there any ways for me to have 238px with 300ppi in InDesign?
I mean, it is for a client with specific requirement of 238px (no requirement of 72ppi). I don't want to give him pixelated image when he opens the image in Preview.
What is this for?
The web? Certainly not for print.
You should be doing it in Photoshop anyway but beyond that, what are you expecting out of a 238px image. At 300ppi that’s less than one inch printed.
There’s zero way to control what it will look like on the web.
PPI is a measurement of pixel per printed inches, so doesn't really exist for an image measured in pixel dimensions. 238px at 300ppi is identical to 238px at 72ppi, and it's pretty small. Bob's advice to do such things in Photoshop (I might add Illustrator) is good, because you can actually see what your work will look like at the final pixel size.
One thing you could possibly do is apply as little compression as possible when saving as JPG. It should at least avoid the horrible fuzzy edges and artifacts inherent in JPG compression (JPG is meant for photos, not text and graphics).