Open.Core.Html.ReplaceWith C# (CSharp) Method

ReplaceWith() public static method

Replaces an element with the given object.
public static ReplaceWith ( string replaceSeletor, jQueryObject withReplacement, bool copyCssClasses ) : void
replaceSeletor string The CSS selector the element(s) to replace.
withReplacement jQueryObject The element to insert.
copyCssClasses bool Flag indicating if CSS classes should be copied from the old element to the new one.
return void
        public static void ReplaceWith(string replaceSeletor, jQueryObject withReplacement, bool copyCssClasses)
        {
            if (copyCssClasses)
            {
                jQueryObject replaceElement = jQuery.Select(replaceSeletor);
                Css.CopyClasses(replaceElement, withReplacement);
            }
            withReplacement.ReplaceAll(replaceSeletor);
        }