你好我有一组来自php,例如(US,JAP,EUR,HK)的数据,我想把它放在修复按钮后面。
当我使用('#heed')时,只需将按钮放在All按钮内 什么命令是正确的命令?
这是我的代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>jQuery Mobile Web App</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script>
$(document).ready(function(e) {
init();
bull();
function init() {
set();
}
});
function set() {
var strLink = '';
strLink = 'http://xxx.xxx.xxx.xxx/portal/xxxxxxx.php?COUNT=XXX';
$.ajax({
dataType: "json",
url: strLink,
success: showme,
async: false
});
}
function showme ( data ) {
var strComname = '' ;
for ( i = 0 ; i < data.length ; i ++ )
KBLINK = data[i]['NEWS_LINK'];
strComname = strComname + '<input type="submit" value="' +data[i]['NEWS_CATEGORY'] + '"'+ 'data-inline="true" />' ;
}
$('#headlist').html(strComname) ;
$('#headlist').listview("refresh") ;
}
</script>
<div data-role="page" id="page_main">
<div data-role="header">
<h1>Result</h1>
<form id='headlist'>
<button incline="true" id='heed'>ALL</button>
</form>
</div>
<div data-role="content">
<ul data-role="listview" id='main'>
<li><a href="#">Page</a></li>
<li><a href="#">Page</a></li>
<li><a href="#">Page</a></li>
</ul>
</div>
</div>
答案 0 :(得分:0)
在表单中使用DIV标记,您可以像这样动态添加按钮:
将表格标签替换为:
<form id='headlist'>
<button incline="true" id='heed'>ALL</button>
<div id='btnAdd'>
</div>
</form>
将按钮添加到DIV标签的Javascript:
$('#btnAdd').html('<button incline="true" id="newBtn">New Button</button>');