I have a function where I count all div fieldcontain with class="count" and append a number according to the result of the count. I would also like to check if there is only one div fieldcontain with class="count" and if so - not append the number of the count. I haven't succeded in finding the correct if statement for this. Or maybe a switch?
- $('#edit').live("pageinit", function(){
- $(this).find('.fieldcontain').each(function(index){
- $(this).append('<div class="count">' + (index + 1) + '</div>');
- });
- });