Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add watermark to the append jquery script?
    primarykey
    data
    text
    <p>I'm trying add a watermark text to some append input. When click the add button it doesn't work, but when I click add again it works for the previous (not current) input.</p> <p>Add remove script:</p> <pre><code>$(document).ready(function() { var counter = 2; var sprycounter = 2; $("#resume_add_education").click(function() { jQuery(function() { $("#resume_education2School, #resume_education3School").Watermark("Name"); $("#resume_education2Campus, #resume_education3Campus").Watermark("Campus"); $("#resume_education2Start, #resume_education3Start").Watermark("Start Year"); $("#resume_education2Finish, #resume_education3Finish").Watermark("Finish Year"); }); if (counter &gt; 3) { alert("Only 3 educations allow"); return false; } var newEducationDiv = $(document.createElement('div')).attr("id", 'educationDiv' + counter); var newEducationTable = $(document.createElement('table')).attr("id", 'educationTable' + counter).attr("width", '100%'); newEducationDiv.after().html('&lt;label style="color: #666"&gt;Education ' + counter + ': &lt;/label&gt;&lt;/br&gt;'); newEducationTable.after().html( '&lt;tr&gt;&lt;td width="50%"&gt;&lt;input type="text" name="resume_education' + counter + 'School' + '" id="resume_education' + counter + 'School' + '" value=""&gt;&lt;/td&gt;' + '&lt;td width="50%"&gt;&lt;input type="text" name="resume_education' + counter + 'Campus' + '" id="resume_education' + counter + 'Campus' + '" value="" &gt;&lt;/td&gt;&lt;/tr&gt;' + '&lt;tr&gt;&lt;td width="50%"&gt;&lt;input type="text" name="resume_education' + counter + 'Start' + '" id="resume_education' + counter + 'Start' + '" value="" &gt;&lt;/td&gt;' + '&lt;td width="50%"&gt;&lt;input type="text" name="resume_education' + counter + 'Finish' + '" id="resume_education' + counter + 'Finish' + '" value="" &gt;&lt;/td&gt;&lt;/tr&gt;' ); newEducationDiv.appendTo("#educationGroup"); newEducationTable.appendTo("#educationGroup"); sprycounter++; counter++; }); $("#resume_minus_education").click(function() { if (counter == 1) { alert("Nothing more to remove"); return false; } counter--; sprycounter--; $("#educationDiv" + counter).remove(); $("#educationTable" + counter).remove(); }); });​ </code></pre> <p>Watermark script:</p> <pre><code>jQuery(function($){ $("#resume_education2Finish, #resume_education3Finish").Watermark("Finish Year"); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload