treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Calling Javascript When Radio Button is Checked

  • Hey Guys,

    I'm trying to call my javascript when my Radio Button is checked, at the moment I've got it calling the javascript onClick, is there any way to make it call the javascript when the radio button is checked, say when I refresh the page?


    <input name="RentalPeriod" type="radio" value="0" onClick="javascript:configureprices('buy');" /><span class="type-radio">Buying</span>
    <input name="RentalPeriod" type="radio" value="3" onClick="javascript:configureprices('rent');" checked="checked" /><span class="type-radio">Renting</span>


    Thanks.
  • Well there is in jQuery...

    http://api.jquery.com/checked-selector/

    in raw JS - maybe 'onChange' would work?