0

what i need

  • i need to append values in html selected values from autocomplete

code

                   $('.autocomplete_ind').autocomplete({
                    lookup: industrys,
                    onSelect: function(suggestion) 
                    {
                        console.log(suggestion);

                        var thehtml = '<strong>industry name:</strong> ' + suggestion.name + ' selected<br> <strong>'+ suggestion.id+'</strong>';
                        $('#outputcontent').append(thehtml);
                        $(this ).attr( "value",  suggestion.value );
                   }

html element

 <input type="text"  autocomplete="off"  onChange="make_url();"
             id="industry_name"  class="biginput autocomplete_ind"  name="allindustry"  value="">
  • i have tried with
  • both of solution does not works .
  • i like on select values from autocomplete values should be view view source also otherwise value remain empty .
  • document.getElementsByName('allindustry')[0].placeholder=suggestion.value;
  • $(this ).attr( "value", suggestion.value ); it works like it append value attribute value="somevalue"
  • but on view source value="" empty shown.
  • any suggestion are most welcome
afeef
  • 547
  • 3
  • 9
  • 25
  • Anything you do with javascript will not be available when you do `view->source` of the page as the page was not loaded with those values that were generated with javascript. Take a look at [http://stackoverflow.com/questions/3163455/what-is-the-difference-between-source-and-generated-source](http://stackoverflow.com/questions/3163455/what-is-the-difference-between-source-and-generated-source) for more info. – lshettyl Jul 07 '15 at 12:47
  • my req is to set values in html then get that values ; in autocomplete is there any another way – afeef Jul 07 '15 at 12:50
  • Sure, when do you want to set/get it? – lshettyl Jul 07 '15 at 12:52
  • set :onchnage select automplete fires; – afeef Jul 07 '15 at 12:56
  • 1
    Something like this => [http://jsfiddle.net/hj4afLqq/](http://jsfiddle.net/hj4afLqq/) ? By the way, this uses autocomplete from `jQuery UI` – lshettyl Jul 07 '15 at 13:02

0 Answers0