Question

When you edit text in a MultiLineTextField which allows rich text, SharePoint switches to "Format text", every time this happens our custom ribbons disappear (they are added with JavaScript).

The only way to get them back so far is reloading the page. I know, it would be easier to add the ribbons with C# but let's just accept, that this solution would be the last one I can use.

My question is: is there any way to receive an event with JavaScript as soon as the textbox is selected/unselected so I can build the ribbons again?

I know, the performance will suck etc., you don't have to mention that. If something is unclear (my English isn't the best any more I guess), mention it, so I can clear things up.

Was it helpful?

Solution

You can use following jQuery to bind the events.

$(document).ready(function () {
    $('#controlid').bind('blur', function () {
        //hide ribbon on lost focus
    }).bind('focus', function () {
        //show ribbon on focus
    });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top