I understand that Stack Overflow answers are released under a Creative Commons license, and that I may use code from Stack Overflow answers (such as this one) in my work.
I want to give credit (as this question mentions that I should) to the OP, how exactly should I do this? I was thinking of adding something along these lines above the relevant code:
// Code created with the help of Stack Overflow question
// https://stackoverflow.com/questions/3808808/how-to-get-element-by-class-in-javascript
// Question by Taylor:
// https://stackoverflow.com/users/460058/taylor
// Answer by Andrew Dunn:
// https://stackoverflow.com/users/451672/andrew-dunn
That's right, right?