I use JQuery to create a dynamic button, when I browse the source code of the webpage, what I see is still JQuery code, such as $("<input>", { "id": "myid", "type"...
I hope to see generated button code such as <input id="Button1" type="button" value="button" />
How can I do?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("<input>", { "id": "myid", "type": "button", "value": "Confirm", "name": "comfire" }).appendTo("#tablemsgbox");
$("#myid").click(function () {
alert($(this).val());
});
});
</script>
</head>
<body>
<input id="Button1" type="button" value="button" />
<div id="tablemsgbox">
</div>
</body>
</html>
Viewing the source shows the original page generated by the server, but won’t show you any DOM manipulations done via javascript. If you want to see the state of the DOM after js manipulation, use tools like Firebug for Firefox, Chrome Inspector, or IE developer tools.