Good work! Your code does the job. Here are my notes on your code:
-
You are utilizing jQuery's
onmethod for aclickevent on your form'ssubmitbutton, which works. But there is a better way. Because we are dealing with a form's submit action, you could utilize jQuery'sonmethod for asubmitevent, which would look like this:$('#style_editor').on('submit', function(event) { //#style-editor is the id of the form
Notice the
submitevent only requires you to locate the form (it automatically knows you are referring to the form's submit action). When binding event handlers to form submit actions, you are going to want to utilize this.Note: You could also utilize jQuery's
submitmethod directly. -
Remember: you can give any HTML node an
idattribute, so you could avoid usingnth-childin this exercise. Simply add anidattribute to the node you want to locate, and then utilize jQuery to find thatid.
Any questions, let me know.
-Phil