Chris
Chris

Reputation: 6042

Event to capture every render of MagicSuggest box

I am applying CSS to the 'selected item' boxes of a Magicsuggest box, each time the 'selectionchange' event is fired. However, it appears these boxes are re-rendered every time the input div loses or gains focus.

With Firefox, I have caught these by reapplying my CSS on the blur and focus events. (Which works, albeit very resource intensive for what I'm trying to do.) In Chrome however, the blur event is never fired (Due to something along these lines, I think.). Is anyone able to work out a way I can capture every re-render of the box with one event, or an alternative solution?

Update 31/8: It now seems that Firefox and Chrome behaviour is the same, my css effects are lost on blur.

More info:

JSFiddle: http://jsfiddle.net/ZyA7B/16/

The code I'm attempting to capture the events with

$(ms).on('blur focus', function(event){
    console.log('fired');
        var selDivs = $(event.target._valueContainer[0].parentNode).children('div');            //Get all the divs in the selction 
        $.each(selDivs,function(index,value){                                $(value).css('background','blue');         
        });
    });

Upvotes: 0

Views: 499

Answers (0)

Related Questions