You are viewing limited content. For full access, please sign in.

Question

Question

Ordered list inserted through Javascript doesn't format correctly.

asked on December 15, 2020

Hello all, I'm having an odd issue here. I have some forms calculations that are set to parse a multiline field, and generate the html for an ordered list. I am then using Javascript to update the html of a custom HTML field. This results in an ordered list, but without the numeric prefixes. I have even explicitly the type of ordered list, and set the start of the list. Directly copying the html from the forms calculation into the custom HTML field results in a correctly formatted list.

Any help or guidance would be appreciated (Pictures Below).

Thanks,

Brett

 

(Generated HTML)

<ol type='1' start='1'><li>do this</li><li>do that</li></ol>

(JS to insert HTML)

$('.SectionsCollection').on('change','.ScriptCheck',function(index,value){
    var scripts = $(this).parents('ul.rpx').find('.ParsedScripts input').val();
	var results = $(this).parents('ul.rpx').find('.ParsedResults input').val(); 
  	$(this).parents('ul.rpx').find('.TestActionsHTML').html('<p>' + scripts + '</p>');
  	$(this).parents('ul.rpx').find('.TestResultsHTML').html('<p>' + results + '</p>');
});

(HTML in Chrome Dev tools showing the incorrect formatting on the left)

(Directly inserting HTML into the field)

0 0

Replies

replied on December 17, 2020 Show version history

Hi Brett,

By comparing a configured custom HTML and custom HTML filled by JavaScript, I see there the difference is that there is an extra div 

<div class="cf-custom" id="Field1">

when the display is correct.

 

Could you try .find('.TestActionsHTML .cf-custom') and .find('.TestResultsHTML .cf-custom')?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.