<html>
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var dataSet = $("#container").remove(); // just grab the data. could have also types it all on one line, same thing
alert("dataSet: " + dataSet.html()); // nothing in my hands
alert("body: (should just be a comment)" + $("body").html()); // nothing up my sleeves
var fields = ["email", "phone"]; // targets
for (var i = 0; i < fields.length; i++) { // foreach...
dataSet.find("[name='" + fields[i] + "']").val("Hello World"); // target change the val
alert("worked here: " + dataSet.find("[name='" + fields[i] + "']").val()); // great! it changed the val
alert("but not here: " + dataSet.html()); // except it didnt.
}
dataSet.html("***"); // yet this works,
alert("yet works this way" + dataSet.html());
});
</script>
</head>
<body>
<!-- Just here to get this into memory-->
<div id="container">
<div>
<label for="email">eMail</label>
<input type="text" name="email" value="this.doesnt@work.com" id="eMail" disabled="">
</div>
<div>
<label for="phone" >phone</label>
<input type="text" name="phone" value="(555) 800-1212" id="phone" disabled="">
</div>
</div>
</body>
</html>