running function based on elements id

running function based on elements id

Hi, I am trying to put together a small function to change the class of a form's input field. I know that I can do this for a specific if but I would like the function to run for multiple fields using the appropriate id. My Javascript experience is limited and so is my jQuery. I am already using jQuery on the page for a dropdown/hamburger menu so would like to use jQuery for this. I would also want to use onChange rather than something like onKeyUp to trigger it as someone might paste with a mouse and I already have a focus class so only need to change the class when someone leaves the field.

What I have so far:

function fieldClass(id) {
    $('id').removeClass('err').addClass('wider');     
}

<input class="err" type="Text" name="eName" id="eName" maxlength="100" placeholder="Please provide a name for the event" onChange="fieldClass(this.id);">

Any help with this would be appreciated.