last day (15 days later) » 

8:50 PM
2
A: Foreach element and add custom data jquery?

TomanowSuccinctly, with jQuery: $('.wizard-step').each(function(k,v) { var classToAdd = 'tab-pane fade'; if (k === 0) { classToAdd += ' in active'; } $(v).prop('id', 'wizard-step-' + (k+1)).addClass(classToAdd).attr('data-step', (k+1)); }); Fiddle

 
This is the shortes and elegant solution, txanks
I have added working fiddle, but i am good at Bootstrap and css, html, jquery is something i am learning @Tomanow, can you help me a little more that i dont write another question, what if i have on some other element active already, please take a look at this fiddle jsfiddle.net/52VtD/9212
 
Sure I will take a look
I think you probably want something like this: // if there are no active wizards, make the first active if (!$('.wizard-step.active').length && i === 0) { $(this).addClass('active'); }
 
Yes but this has to be like in you answer added, to have that all and that option to
 
Here ya go: FIDDLE
 
Txanks mate, this is great
 
8:50 PM
You're welcome, enjoy.
 
Hello mate sorry but i does not wot
work
I need if there is no active class add to first
but i there is active do not add that class to no one
 
hey
what is not working?
 
hello mate
i ahve problem because i ams using bootstrap
with that stupid class in
:(
somebody will now know it has to add
in active
:(
it will just add active
i must check that aslo
:(
sorry about my speed writing mistakes
not know
Txanks in advance you are greatest
 
so change this line:
$(v).addClass('active');
to this:
`$(v).addClass('in active');`
without ` symbols of course
 
9:12 PM
Txanks
 

last day (15 days later) »