I am creating a webpage using jQuery mobile.i am new to this technology. I want to navigate to another page by list item click. while going to second page i want to pass the text value from list item and list item id for displaying it. Can anyone guide me?
My HTML code is:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Demo Page</title>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css"/>
function onDeviceReady() {}
document.addEventListener("deviceready", onDeviceReady, false);
function Button_onclick() {
for(i=0; i < 3; i++){
$("#numbers").append('<li id="'+i+'" ><a href="#page2#">' +i+'</a></li>' );
$('#numbers').listview('refresh');
}
}
</script>
</head>
<body>
<div >
<input id="Click_Button" type="button" value="Submit" onclick="Button_onclick()" />
</div>
<div id="divList" data-role="content">
<ul id="numbers" data-role="listview" data-inset="true"> </ul>
</div>
</div>
<div data-role="page" id="page2">
<div data-role="header">
<h1>Page Two</h1>
</div>
<div data-role="content">
<p>Welcome to page 2.</p>
</div>
</div>
</body>
</html>