0

I am a newbie to web development and have following basic question.

My Html looks like this:

<a class="btn-select" data-myId="10091" data-myDescr="The thing we delete">Click me!</a>

My coffee script looks like this:

$(document).on 'click', '.btn-select', ->
requestId = $(this).data('myId');
alert 'hello ' + requestId;

But when I click the button, I get "hello undefined". What am I missing here?

0

1 Answer 1

1

HTML5 data-attrs are required by the spec to be lowercase.

Use: $(this).data('myid')

http://jsfiddle.net/6RW79/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.