Social Sharing

Functions in the Social Sharing category interact with the solution after it’s been launched and the function janrainSocialOnLoad has been called.


The addWidgetTo function attaches the share tool to an HTML element. This allows the share widget to be dynamically added to a page.

The following fields in the object interact with the social sharing solution:

Field Description
element The HTML element to attach to.
options An optional JavaScript object containing settings to use instead of the data-janrain-* HTML attributes. The keys are camelCase instead of harpoon-case, like in the HTML attributes, and do not include the data-janrain- prefix. For example, the setting




var e = document.createElement("div");
document.body.appendChild(e);, { url: "", formFactor: "drawer" });

Using JQuery without options:

var placeholder = $("
    .attr("data-janrain-url", "")

If you wish to load the markup for Social Sharing after the page has loaded, you could manually instantiate a share bar on an element by targeting an element and using addWidgetTo. The following example would grab the last janrainSocialPlacholder element on the page and instantiate the tool there:$(".janrainSocialPlaceholder").get(-1), { url: "" })