Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS styling is being lost when lis are dynamically added to a ul
    primarykey
    data
    text
    <p>I am attempting to dynamically add links to a page but my css styling is only being applied to the list items the first time the list is created after each reload. </p> <p>Below is my html:</p> <pre><code> &lt;div data-role="page" data-theme="b" id="selectConfirmation"&gt; &lt;div data-role="header" data-theme="b" &gt; &lt;a class="cancelSelectConfirmationBtn ui-btn-left" data-role="button" data-icon="arrow-l" data-iconpos="left" data-theme="b"&gt;Back&lt;/a&gt; &lt;h1&gt; Confirmation Events &lt;/h1&gt; &lt;/div&gt; &lt;div data-role="content" style="font-size: 16px;"&gt; &lt;ul id="eventList" data-role="listview" class="ui-listview"&gt;&lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and here is the portion of my java script that is adding the links:</p> <p>function createList(ceg){ </p> <p>var list = document.getElementById('eventList');</p> <pre><code>for(i=ceg.length-1,k=0; k&lt;ceg.length; i--,k++){ var check = ceg.charAt(i); if(check == 1){ var events = configJSON.root.DynamicDef.Application.SB_Primary.add[k]["-Data"].split(";"); var li = document.createElement('li'); li.innerHTML = '&lt;a&gt; ' + events[1] + '&lt;/a&gt;'; li.setAttribute('class', 'selectConfirmation'); li.setAttribute('confirmcode', '5'); li.setAttribute('data-theme', 'c'); list.appendChild(li); } } var $list = $(list); if ($list.hasClass('ui-listview')) {//this listview has already been initialized so refresh it $list.listview('refresh'); } else {//this list needs to be initialized $list.trigger('create'); } </code></pre> <p>gotoConfirmation(); }</p> <p>Does anyone know why the css styling is being dropped when i recreate the list?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload