Good work! Your code does the job. Here are my notes on your code:
-
You are utilizing jQuery's
on
method for aclick
event on your form'ssubmit
button, which works. But there is a better way. Because we are dealing with a form's submit action, you could utilize jQuery'son
method for asubmit
event, which would look like this:$('#style_editor').on('submit', function(event) { //#style-editor is the id of the form
Notice the
submit
event 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
submit
method directly. -
Remember: you can give any HTML node an
id
attribute, so you could avoid usingnth-child
in this exercise. Simply add anid
attribute to the node you want to locate, and then utilize jQuery to find thatid
.
Any questions, let me know.
-Phil