i have values in data like BSIT|MSIT|BSC| etc when i used alert(). to display data values then values are correct but when values appear in drop down they become |||||||||BSIT code is like this var programs=[]; alert(data); programs=data.split('|'); $('#p_course').length = 1; for(var i=0;i<programs.length-1;i++) { var objDropdown =$('#p_course').get(0); var objOption = new Option(programs[i],programs[i]);// adding option objDropdown.options[objDropdown.length] = objOption; }
actually i m storing these values in data from db may be thats why there is a problem bcs when i use static value then it appear correctly. If u can understand whts gng on plz tell me thnx alot On Jul 18, 12:55 pm, Theodore Ni <zyl...@gmail.com> wrote: > Please post again your current jQuery code including the separator you are > using, as well as what is inside the data variable in full. That way, we can > understand exactly what's going on; right now, I'm still confused. > Teddy > > > > On Sat, Jul 18, 2009 at 12:07 AM, naz <s.na...@gmail.com> wrote: > > > i have changed '|' seperator still it is not working.:( > > > On Jul 16, 10:31 am, 刘永杰 <liuyongjie...@gmail.com> wrote: > > > change split character,not use '|'. > > > > 2009/7/16 naz <s.na...@gmail.com> > > > > > hi > > > > i m adding some values to drop down > > > > by usind j query by this code > > > > var programs=[]; > > > > programs=data.split('|'); > > > > $('#p_course').length = 1; > > > > for(var i=0;i<programs.length-1;i++) > > > > { > > > > var objDropdown =$('#p_course').get(0); > > > > var objOption = new Option(programs[i],programs[i]); > > > > objDropdown.options[objDropdown.length] = objOption; > > > > } > > > > but when vales appear in drop down first value look like this > > > > |||||||||||||BSIT > > > > any body have any idea why it look like this- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -