Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding elements dynamically to DOM in $(document).ready(function(){}); adds the elements but they arent visible. why?
    primarykey
    data
    text
    <p>I am adding two collapsibles of jquery-mobile in $(document).ready(function(){ });</p> <p>It looks like this</p> <pre><code>$(document).ready(function() { var l_freeCollabsible=fCreateCollapsible("Free", "Free Content"); var l_bestSellCollabsible=fCreateCollapsible("Best Sellers", "Best Selling Content"); var l_frag = document.createDocumentFragment(); l_frag.appendChild(l_freeCollabsible); l_frag.appendChild(l_bestSellCollabsible); document.body.appendChild(l_frag); }); </code></pre> <p>fCreateCollapsible() looks like this</p> <pre><code> function fCreateCollapsible(heading,content){ var l_collapsible = fDomCrElemTypeTheme("div","collapsible","b","b"); l_collapsible.setAttribute("data-iconpos","right"); var l_heading = fDomCrElemText("h4",heading); var l_content = fDomCrElemText("span",content); apc(l_collapsible,l_heading); apc(l_collapsible,l_content); return l_collapsible; } </code></pre> <p>this function creates the following structure</p> <pre><code>&lt;div data-role="collapsible" data-theme="b" data-content-theme="b" data-iconpos="right"&gt; &lt;h4&gt;Heading&lt;/h4&gt; &lt;span&gt; Content &lt;/span&gt; &lt;/div&gt; </code></pre> <p>My Problem is that after Dom ready is called the elements are created as I want, but they are hidden. </p> <p>I tried creating a function, putting the element creation code in it and calling the function from inside the body. It works perfectly. </p> <p>Is there any way to apply jquery styles in the ready function? I want to create all the elements dynamically with an empty pair of body tags. I am trying to create a simple mobile application with jqm+phonegap</p> <p>am using jquery-mobile-1.3.2 and jquery-1.9.1. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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