Your question is a little ambiguous, so I am going to make some assumptions -
By 'Charger' if you mean the 120V charger that normally operates off of shore power, then whiie it may be possible depending on your boat's AC panel configuration (for example, my 2011 R27 allows the charger to be powered from the inverter), it is NOT RECOMMENDED! This is probably the easiest way to kill your batteries. Think about it: you are using the battery to power the inverter, then using the 120V AC created by the inverter to power the battery charger, thus charging the batteries. In a perfect world with no losses, this 'circular reference' could go on forever. But in reality, both the inverter and charger are less than 100% efficient, so that loss over time will just eat away your battery.
If the 'Charger' in your question is a charger that is powered off the engine / alternator (or even solar), then yes, that should be fine to run the inverter for AC power while underway.
Hope this helps