I using each()
but only return the contents of first element...
For example: http://jsfiddle.net/UserNaN/L8pA5/
How to get all the contents with div have same ID is #title
Please help me!
I using each()
but only return the contents of first element...
For example: http://jsfiddle.net/UserNaN/L8pA5/
How to get all the contents with div have same ID is #title
Please help me!
It will surely fail since ids have to be unique.
Use classes instead. You've already set active
class to the div
.
So, you can do:
$('.active').each()
Never use same ID for multiple elements. ID has to be unique of course. For your purposes you should use classes
So:
<div class='title active' data='1'>
$('#container').find('.title').each(...
use $("div#title").each(function(){});
I was facing same problem. Its working for me.