0
<div data-progress="0"></div>

$('div').css('data-progress',10');

why this doesn't work? I'd put this within a loop and manipulate the div's data-progress attr but nothing happened.

1
  • 1
    Should that ' character be there, to the right of the 10? Commented Feb 26, 2015 at 3:23

1 Answer 1

2

It doesn't work because data-progress is not a CSS property, it is a custom attribute.

Use the .attr() method to modify the attribute.

$('div').attr('data-progress', 10);

Also, you had a stray ' after the 10, remove that.

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.