What's the efficient way to modify variable of jquery?
Hello everyone...!
Current topic is that I have
this div: named as "
contact_person"
<div name="
contact_person" class="round"><table width="590" border="0">
<tr>
<td>
<input type="button" name="contactpremove-1" value="-" />
<input type="button" name="contactpadd" id="contactpadd" value="+" />Contact Person</td>
</tr>
<tr>
<td>
<select name="contactptitle" >
<option>Mr.</option>
<option>Ms.</option>
</select>
<input type="text" name="contactpname" size="80" /> </td>
</tr>
<tr>
<td>Mobile :<input type="text" name="mobile" />
Email :<input type="text" name="email" size="40" /></td>
</tr>
<tr>
<td>Designation : <input type="text" name="designation" size="50" /></td>
</tr>
<tr>
<td>Product Handling :<input type="text" name="producthandling" size="60" /> </td>
</tr>
</table>
</div> <!--akhir contact person div-->
And also my purpose is that the
button named as : "
contactpadd" will
copy that div content and
inserting a new div with that
copied content after that div element, and next click on that button will do the same so on and so on... copied, inserted next, copied, inserted next, bla bla bla....
But I wonder if I use this jquery script;
$('#contactpadd').live("click", function(){
var obj = $('div[name="contact_person"]');
alert($(obj).length);
if(obj.length!=5){
// do adding new div for contact_person
var conten = $(obj[0]).html();
$(obj[0]).after($('<div name="contact_person">'+conten+'</div>'));
}
} );
But, how Could I manipulate / modify the
conten variable so then the
copied content have a different buttons?
Which is;
the both button named as:
contactpremove could be
changed its id numbering,
and then another button named as :
contactpadd could be removed?
The buttons that I mentioned is colored using
RED And Blue color.