Current location: Hot Scripts Forums » General Web Coding » JavaScript » Autcomplete for dynamically created i/p box


Autcomplete for dynamically created i/p box

Reply
  #1 (permalink)  
Old 03-20-10, 02:38 AM
chocoboy308 chocoboy308 is offline
New Member
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Autcomplete for dynamically created i/p box

I have an input box "product" besides it there is an add input button which adds another input box product upon clicking.This array of input boxes I have created is through document.createElement('input').

My autocomplete is working for the initial input box....now when I click add Input button for the generated box also the autocomplete shld work...how do I make it work??

PS:Autocomplete script is working so I didnt post it here.... I just want it to make it working dynamically created i/p boxes
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-20-10, 02:39 AM
chocoboy308 chocoboy308 is offline
New Member
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript" src="ajax-dynamic-list.js"></script>  
	<link rel="stylesheet" href="../css/style.css" type="text/css" media="all" />
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Golden Collection </title>
<style type="text/css">	 
	
	#mainContainer{
		width:660px;
		margin:0 auto;
		text-align:left;
		height:100%;
		background-color:#FFF;
		border-left:3px double #000;
		border-right:3px double #000;
	}
	#formContent{
		padding:5px;
	}
	/* END CSS ONLY NEEDED IN DEMO */
/* Big box with list of options */
	#ajax_listOfOptions{
		position:absolute;	/* Never change this one */
		width:175px;	/* Width of box */
		height:250px;	/* Height of box */
		overflow:auto;	/* Scrolling features */
		border:1px solid #317082;	/* Dark green border */
		background-color:#FFF;	/* White background color */
		text-align:left;
		font-size:0.9em;
		z-index:100;
	}
	#ajax_listOfOptions div{	/* General rule for both .optionDiv and .optionDivSelected */
		margin:1px;		
		padding:1px;
		cursor:pointer;
		font-size:0.9em;
	}
	#ajax_listOfOptions .optionDiv{	/* Div for each item in list */
		
	}
	#ajax_listOfOptions .optionDivSelected{ /* Selected item in the list */
		background-color:#317082;
		color:#FFF;
	}
	#ajax_listOfOptions_iframe{
		background-color:#F00;
		position:absolute;
		z-index:5;
	}
	
	form{
		display:inline;
	}
	
	</style>

<script type="text/javascript" language="javascript"> 
 function addRow1(id){
    var tbody = document.getElementById
  (id).getElementsByTagName("TBODY")[0];
  
    var row = document.createElement("TR")
   var td2 = document.createElement("TD")
  var tt2 = document.createElement('input')
  tt2.type = 'text'
    tt2.value = ''
  tt2.size = '45'
  tt2.name = 'prod_name[]'
   td2.appendChild (tt2)
		
 
  var td3 = document.createElement("TD")
  td3.setAttribute('align','left')
  var tt3 = document.createElement('input')
  tt3.type = 'button'
    tt3.value = 'Remove'
  tt3.name = 'bttn' 
  tt3.onclick=function(){removeRowFromTable1(this);};
    td3.appendChild (tt3)
  
   row.appendChild(td2);
  row.appendChild(td3);
  tbody.appendChild(row);   

  }
  function removeRowFromTable1(obj){

 var tbl = document.getElementById('exp1254911560'); 
 var par=obj.parentNode;
 par=par.parentNode;
 var tt = par.rowIndex;
 tbl.deleteRow(par.rowIndex);
}
 
 </script>

</head>

<body>

 <form name="form1" method="post"> 
<table width="98%" cellpadding="0" cellspacing="0"  class="data-table">

<tr><td  colspan="9">
 <table id="exp1254911560">
               
               
                <td width="31%">Product Name <span style="color:#FF0000"> * </span></td>
               
                <td><input type="button" name="add" value="Add Input" onClick="addRow1('exp1254911560')"></td>
                </tr>
				 <tr>
                    <td><h6>
    <input name="prod_name[]" type="text" size="45" onKeyUp="ajax_showOptions(this,'getname',event)"   />  
  </h6></td>  
               
                
                <td><input type="button" name="remove[]" value="Remove" onClick="removeRowFromTable1(this)" ></td>
                </tr>
               </table>  
               
</td>
</tr>
</table>
</form> 

</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-20-10, 09:17 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Please rephrase your request, I don't understand it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill a Text Field from a Drop-Down Box giza65 JavaScript 3 03-02-10 06:28 PM
4 corner liquid box issue sample... ArtphotoasiA HTML/XHTML/XML 0 12-10-09 11:40 AM
[SOLVED] General box positioning questions Shelby HTML/XHTML/XML 21 05-18-08 07:35 AM
change drop down box based on textbox talax JavaScript 1 02-24-05 08:38 AM
Shout box, comment box, or search script. Need help to find all! Spreegem Script Requests 1 05-29-04 10:45 PM


All times are GMT -5. The time now is 01:37 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.