[Solved] Create Code Snippet (easy to cut and paste) from Web Form [closed]


something like this, using val() to get the input from the user:

HTML:

name:<input type="text" id="name" />
<br />
price:<input type="text" id="price"/>
<br />
description:<input type="text" id="description"/>
<br />
url for event:<input type="text" id="url_for_event" />
<br />
<button id="create-html">create html</button>

<div id="result"></div>

JS:

$( "#create-html" ).click(function() {
    var name="<p class="name">" + $("#name").val() + '</p>';
    var price="<p class="price">" + $("#price").val() + '</p>';
    var description = '<p class="desc">' + $("#description").val() +'</p>';
    var url_for_event="<p class="url">Share the <a href="" + $("#url_for_event").val() +'">event with your friends</a></p>';
    $( "#result" ).text(name + price + description + url_for_event);
});

demo: http://jsfiddle.net/cLK7z/2/

solved Create Code Snippet (easy to cut and paste) from Web Form [closed]