Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Textbox transform in Select Dropdown based on closest div when function onchanged trigger at one of the field; option failed populated

$
0
0

Hi All,

The textbox name: q able to transform become select field when some function trigger. But, I failed to populate the option into the new select field. How can I do that?

Something wrong with this code:

var options = $(this).closest('div').find("select[name^='q']");//what should I need to do here???

var plazosHtml = "";
                var controller = $(this).val().split('.')[0];
                var html = "<select id='q' name='q'></select>";$(this).closest('div').find('#q').replaceWith(html);$.ajax({
                    url: '@Url.Content("~/Admin/CurrencyList/")',
                    type: 'POST',
                    dataType: 'json',
                    success: function (data) {
                        var options = $(this).closest('div').find("select[name^='q']");//what should I need to do here???$.each(data, function () {
                            //alert(this.Description); // came from .NET Dictionary's Key Value pair
                            options.append($('<option />').val(this.CurrID).text(this.Description));
                        });
                    }
                });

            } else {
                var html = "<input type='text' size='30' id='q' name='q' class='qsbox' />";$(this).closest('div').find('#q').replaceWith(html);
            }

Please advise.

Regards,

Micheale


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>