Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save philsof/06dcea1c988273cceec2 to your computer and use it in GitHub Desktop.
Save philsof/06dcea1c988273cceec2 to your computer and use it in GitHub Desktop.
Code review pair-kb-diangelo,kerryimai behavior-drill-style-editor-challenge 02-01-2016

Good work! Your code does the job. Here are my notes on your code:

  • You are utilizing jQuery's on method for a click event on your form's submit button, which works. But there is a better way. Because we are dealing with a form's submit action, you could utilize jQuery's on method for a submit 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 using nth-child in this exercise. Simply add an id attribute to the node you want to locate, and then utilize jQuery to find that id.

Any questions, let me know.

-Phil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment