Setting aside the fact that this is easily circumventable, and just dealing with the specific requirement of escaping apostrophes from all text inputs on submit, here's one method:
- Use the jQuery
submit
function to bind an event handler. - In the handler use a jQuery selector to find all the
textarea
andinput type='text'
fields on the form (probably using the multiple selector and the appropiate standard CSS selector syntax by type and attribute). - Once you have the jQuery object containing all the inputs (the
length
property will help you verify that), you need to loop over.each
one, passing in a function that likely uses thereplace
function to change thetext
.
That's a pretty link heavy set of steps, but it should give you what you need to start understanding jQuery based event handling and DOM traversal and manipulation.