javascript - jQuery mobile: Dynamically loading content (problems with textbox) -


If I change the html contents of a div dynamically, then I have a problem with jQuery mobile. Here's the minimum code for my problem, followed by a detailed description:

   and;); - Load load content (' & gt; button & gt; button 0 & lt; / button & click on ($ ''); $ ('function') {loadContent ('& gt; button & gt; button 1 & lt; / button & gt;';}}};}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div data-role = "page" id = "page" & gt; & Lt; div data-role = "panel" data-display = "overlay" id = "mypanel" & gt; & Lt; H1 & gt; Menu & lt; / H1> & Lt; P & gt; You can close the panel by clicking outside the panel, by pressing the Esc key or swiping it. & Lt; / P & gt; & Lt; / Div & gt; & Lt; div data-role = "header" & gt; & Lt; / Div & gt; & Lt; div data-role = "main" square = "ui-content" & gt; & Lt; div class = "content" & gt; & Lt; / Div & gt; & Lt; Button ID = "Change" & gt; Change content & lt; / Button & gt; & Lt; / Div & gt; & Lt; Div data-role = "footer" & gt; & Lt; div class = "selection-language" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

The page contains a div with a class with content . Javascript-function LoadSystem (content) loads the logic given as plain HTML in all div elements with the class content .

The html-code is loaded, the trigger create is executed. The reason for this is that the HTML-code should be displayed with jQuery's mobile style.

Loads the code example by clicking on a button button 0 and Change the contents there is a button instead of the button The button will be 1 . It works fine.

But if the initial loadcontent -call has any input tag, it will not work input element LoadContent is also after returning .

To perform this test I made a commentary line (the first line at the initial ceremony)

I came to know that this only happens when I add the trigger to create , but without the trigger the content looks ugly.

Is there any idea why even after returning input element loadContent ?

Thanks,

The best of Kevin

Instead $ (function () {... You should use jQuery mobile page events such as pagecreate instead. .trigger ("create") version 1.4, you can use .enhanceWithin () :

  $ (document) .on ("pagecreate", "# page ", function () {loadContent ('& lt; input type =" text "/> click (function () (loadTaint (' 'button & gt; button 1 & lt; / button & Gt; ');});';}}; function loads Claim (content) {$ ('div.content'). Html (content) .hounsen ();}   

< / blockquote>

In your posted source code, you are adding jQM library twice and just add at least one (jquery.mobile-1.4.2.min.js) and leave uncompressed one.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -