/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Clone Autocomplete text box

Hi,
I have a text box in a table row to which i have attached the auto complete feature.
While cloning , it is cloning the text box and the other items of row …but not able to get that autocomplete feature on the cloned text box.

Any help appreciated.

[CODE]

<script type=”text/javascript”>
// cloning rows

var clone;

function addRow(){
var tb=document.getElementById(‘List’).getElementsByTagName(‘tbody’)[0];
tb.appendChild(clone);
cloneRow();
}
function cloneRow(){
var rows=document.getElementById(‘List’).getElementsByTagName(‘tr’);
var index=rows.length+1;
clone=rows[rows.length-1].cloneNode(true);
var inputs=clone.getElementsByTagName(‘input’), inp, i=0;
while(inp=inputs[i++] )
{
inp.name=inp.name.replace(/d{1,}/g,index);
}
var selects=clone.getElementsByTagName(‘select’), sel, j=0;
while(sel=selects[j++] ){
sel.name=sel.name.replace(/d{1,}/g,index);
}

}
onload=cloneRow

function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;

for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(null != chkbox && true == chkbox.checked && rowCount>2) {
table.deleteRow(i);
rowCount–;
i–;
}

}
}catch(e) {
alert(e);
}
}

</script>

<script type=”text/javascript” src=”jquery.js”></script>
<script type=’text/javascript’ src=’jquery.autocomplete.js’></script>
<link rel=”stylesheet” type=”text/css” href=”jquery.autocomplete.css” />

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

$(“#chel”).autocomplete(“get.php”, {
width: 260,
matchContains: true,
mustMatch: true,
selectFirst: false
});

$(“#chel”).result(function(event, data, formatted) {
$(“#chel_val”).val(data[1]);
});
});
</script>

[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @tweety_scorpion spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...