Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript jQuery Basics Working with jQuery Collections Stopping the Browser's Default Behavior

Unobtrusive checkbox

Hi there, I am having problems with making the checkbox unobtrusive. My added attributes are canceled out too. Did I do something wrong here?

Here is a link to a snapshot of my workspace: https://w.trhou.se/5ftn1bu3zd

Thank you.

1 Answer

Steven Parker
Steven Parker
231,261 Points

The code on line 11 has a syntax error. Literal quote marks inside a string must be a different type from the ones used to enclose the string, or they must be escaped by a backslash:

// as in the video:
const $pdfCheckbox = $('<label><input type="checkbox"> Allow PDF downloads</label>');
// OR this would also work:
const $pdfCheckbox = $('<label><input type=\'checkbox\'> Allow PDF downloads</label>');