Forum General


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Textbox autocomplete multiple search

AMNKumariAMNKumari USMember ✭✭✭
edited July 2020 in General

this is my textbox auto complete function. its loading fine but i want to load suggestions only user enter this " [ " sign. user can enter multiple times in one textbox. like this

hello [world] this is [my] sample.

function getOnChangeText() { 
    var str = $("#txtMyText").val();   
   if (str = "[") {
        var strText = str.replace("[", "");
        url: '../../Page/TextSearch',
        type: 'POST',
        dataType: 'json',
        data: JSON.stringify({ translateText: strText }), 
        contentType: 'application/json; charset=utf-8',
        success: function (data) {
                  source: data


  • bananaprinterbananaprinter USMember ✭✭
    edited July 2020

    You are only verifying when the user enters a string value, so if the user enters "[[" or "[[[" and so on it will not enter the if block. So instead of verifying for a fixed value such as "[" you need to evaluate the string and then check if it contains the "[" character, and if so, continue the autocomplete.
    Also this is javascript, and I am not sure but I think this is a Xamarin only forum so you should stick to Xamarin related questions. Personally I have never used javascript with Xamarin.

Sign In or Register to comment.