0

I'm trying to wrap the contents of a form element in a div with the class .content and I'm getting an error that the inner $(element).html() is a "unrecognized expression".

$(element).html($($(element).html()).wrap($("<div>").addClass(".content")));

Ideas?

4

1 回答 1

1

我认为您正在寻找的是.wrapInner()

$(element).wrapInner('<div class="content" />')
于 2013-10-26T14:21:30.080 回答