Best way to work with UL LI lists?


#1

I have a site with styled UL LI lists:

<li>
    <h3>Title</h3>
    <p>content</p>
</li>

Is it possible for these to be duplicated so the client can create new ones?


#2

Hi,

not currently, but we started to work on new feature that will allow adding HTML blocks.


#3

Hi @urbanedgedesign,

I just dealt with it but with divs.
As a workaround what you can do is to set up a generic title, for instance : <h3>text_to_replace</h3> , and remove it only in front end with js when the function match the string :

if ( !window.sitecakeGlobals || sitecakeGlobals.editMode !== true ) {
	var container = $('#content li h3');
	container.each(function(i){
		var titleliBox = $(container[i]);
		var featBxStr = titleliBox.html();
		if (~featBxStr.indexOf("text_to_replace")){
			var parentBox = titleliBox.parent();
			parentBox.remove();
			return true;
		}
	})
}

You will maybe have to adapt the code to your exact context but here is the idea.
Hope it helps.

If anyone has a better way to achieve it or think that this function can be improved, just let me know.


#4

Like that you can duplicate the LI a lot on the html before all the LI are filled up and if needed, regurlarly add some manually.


#5

@Rom Thanks for sharing.