Create Button and Add Icon
Description
The following code shows how to create Button and Add Icon.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type="text/javascript"
src="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.css">
<style type='text/css'>
.cloner {<!-- w w w . j ava2 s .c o m-->
display: none;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$("#add-icon-button").click(function () {
var $button = $(".cloner").clone().attr("data-role", "button").buttonMarkup({
icon: "star"
}).removeClass("cloner");
$("#new").html($button);
});
});//]]>
</script>
</head>
<body>
<a data-role="button" id="add-icon-button">Add</a>
<br>
<br>
<div class="button-container">
<a data-role="button" data-theme="b">Button</a>
<a class="cloner" data-role="none" data-theme="b">Button</a>
</div>
<div id="new"></div>
</body>
</html>