0

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(','));
            }
        });
    });
1
Contributor
1
Reply
13
Views
2 Years
Discussion Span
Last Post by Jake.20
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.