Greetings Pros,

I just want to ask how can i format a certain string to italic. I have this code but it's not working. Well I know it will not work because the array is still in array format not in string yet. Right?

$(document).ready(function() {
        //The demo tag array
        var availableTags = [];
        $.getJSON("{!! URL::to('/') !!}/retrieve/contacts", function(data) {
            $.each(data, function(key, val) {
                availableTags.push(val.dta + " Phone: " + val.phne.italics() + "", val.id);

            });
        });
        //The text input
        var input = $("input#txt");

        //The tagit list
        var instance = $("<ul class=\"tags\"></ul>");

        //Store the current tags
        //Note: the tags here can be split by any of the trigger keys
        //      as tagit will split on the trigger keys anything passed
        var currentTags = input.val();

        //Hide the input and append tagit to the dom
        input.hide().after(instance);

        //Initialize tagit
        instance.tagit({
            tagSource:availableTags,
            fieldName: "items[]",
            allowSpaces: true,
            removeConfirmation: true,
            tagsChanged:function () {

            //Get the tags
                var tags = instance.tagit('tags[]');
                var tagString = [];

            //Pull out only value
                for (var i in tags) {
                    tagString.push(tags[i].value);
                }

            //Put the tags into the input, joint by a ','
            input.val(tagString.join(','));
            }
        });
    });

And also how can i use this code in my case:

.replace('/ Phone: /g', '');

i want to remove the phone after the user selects it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.