Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#5866 closed bug (notabug)

Problem With Autocomplete Of Cloned Element

Reported by: john123 Owned by:
Priority: minor Milestone:
Component: ui.autocomplete Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:



It appears that autocomplete cannot be overridden on a cloned element. See the simple example below:

<html> <head> <link rel="stylesheet" type="text/css" media="all" href="../jq/css/ui-lightness/jquery-ui-1.8.2.custom.css" />

<script type="text/javascript" src="../jq/js/jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="../jq/js/jquery-ui-1.8.2.custom.min.js"></script>

<link type="text/css" href="../jq/development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" />

<script type="text/javascript"> $(document).ready(function() {

jQuery(function() {

$("input[name*=name]").each(function() {


source: ["Fred", "Harold"]


}); $('.plus').bind('click', addRow);


}); function addRow(e) {

var tblRow = $(this).parents("tr"); var newTblRow = tblRow.clone(true); $(this).parents("span").text(""); newTblRow.insertAfter(tblRow); newTblRow.children().each(function() {

$(this).children("input").each(function() {

var theName = $(this).attr("name"); var splitName = theName.split("_"); var varName = splitName[0]; var idx = splitName[1]*1; var newIdx = idx+1; var newName = varName + "_" + newIdx; $(this).attr("name", newName); $(this).attr("value", ""); if (theName.indexOf('name') != -1) {

$(this).autocomplete("destroy"); $(this).autocomplete({

source: ["Jim", "Lou"]





} </script> </head> <body> <form name=theForm> <center> <table> <tr> <th></th> <th>Name</th> <th>Age</th> </tr> <tr> <td><span class=plus>+</span></td> <td><input type=text name=name size=17></input></td> <td><input type=text name=age size=4></input></td> </tr> </table> </form> </body> </html>

Change History (2)

comment:1 Changed 11 years ago by Scott González

Resolution: invalid
Status: newclosed

We don't support cloning plugins.

comment:2 Changed 9 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.