Created
July 3, 2014 22:38
-
-
Save townivan/f8346fcc432db32518a6 to your computer and use it in GitHub Desktop.
jquerymobile add a control dynamically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Load Control Dynamically</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.3/jquery.mobile-1.4.3.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.4.3/jquery.mobile-1.4.3.min.js"></script> | |
<script> | |
$(document).on( "pageinit", function() { | |
$( "#addNewButton").on( "click", function() { | |
$('#Container').append($('<input id="Button1" type="button" value="Custom button" />')); | |
$('#Container').trigger('create'); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="page1" data-role="page" data-theme="a"> | |
<div data-role="header"> | |
<h1> | |
Add New button | |
</h1> | |
</div> | |
<div data-role="content" id="content"> | |
<a data-role="button" id="addNewButton">Add New button</a> | |
<div id="Container" /> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment