入力されたテキストをテキストの段落のプレースホルダーに配置する jQuery を使用した例を次に示します。ここで実際のサンプルを試すことができます:
http://jsfiddle.net/hansvedo/D63K7/
<form id="info_form">
<input id="first_name" type="text" value="John">
<input id="submit_button" type="submit" value="Submit">
</form>
Placeholder text
<div id="paragraph">Hi <span id="first_name_placeholder"></span>, lorem ipsum.</div>
$(document).ready(function(){
$('#submit_button').click(function(event){
// Stop the form from actually submitting.
event.preventDefault();
// Capture the entered name and put it into the placeholder.
var first_name = $('#first_name').val();
$('#first_name_placeholder').html(first_name);
// Hide the form
$('#info_form').hide();
// Reveal the paragraph.
$('#paragraph').show();
});
});