Calculate Resistor Value for Optocoupler - 24VDC Anode
The resistor value is calculated like any common LED

$$ R= \frac {V_{in}-ledV_F}{I_{LED}} $$

The actual value depends on the current you want through the LED



For 60mA and typical VF= 1.25v

$$ R= \frac {24v-1.25v}{{0.060A}}$$ which results to about 380 Ohm



If you want to calculate for VF= 1.5v
$$ R= \frac {24v-1.5v}{{0.060A}}$$ which results to about 375 Ohm



Peter Bennett made a good point in the comments below about the resistor power rating, make sure it is appropriately sized.

The resistor power is calculated as

$$ P= {I}^2 * R = {0.06}^2 * 380 ohm = 1.368W $$ so a 2W resistor should be good enough