html how can write and create function into jquery

7331

New Member
\[code\]if (temp == 'Gps') { $('#tabs-1').html('<fieldset class="fieldstyle"><legend>Label</legend><input type="text" id="titlebox-' + id + '" value="' + temp + '"/></fieldset><br><p><label>Add to PunchList</label><input type="checkbox" id="punchlist" class="require"/></p><p><label>Mandatory Field</label><input type="checkbox" id="mfield" class="require"/></p><p><label>Include in PDF Export?</label><input type="checkbox" id="pdf" class="require"/></p><br> <fieldset class="fieldstyle"><legend>Field Description</legend><textarea id="instructmsg" value="' + inst + '"></textarea></fieldset> ');}else if (temp == 'Photo') { $('#tabs-1').html('<fieldset class="fieldstyle"><legend>Label</legend><input type="text" id="titlebox-' + id + '" value="' + temp + '"/></fieldset><br><p><label>Add to PunchList</label><input type="checkbox" id="punchlist" class="require"/></p><p><label>Mandatory Field</label><input type="checkbox" id="mfield" class="require"/></p><p><label>Include in PDF Export?</label><input type="checkbox" id="pdf" class="require"/></p><br> <fieldset class="fieldstyle"><legend>Field Description</legend><textarea id="instructmsg" value="' + inst + '"></textarea></fieldset> ');}\[/code\]The html code above is repeated. How can I write a function for this using jquery and how can I call that function? How can it be loaded? How do I write all this into a single js page?
 
Back
Top