Click here to Skip to main content
15,887,318 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
More of a best practices question.

I'm creating a jquery plugin and I want to append a fairly large amount of html into a panel in the panel-body section. I've got it working by using;

JavaScript
var res = '<div><input type="text" data-action="calc_1" /></div>';
$(this).each(function (e) {
    $(this.element).find('.panel-body').append(res);
    $(this.element).on('keyup', this.someOtherFunction);
});


and it is working as designed but the html there is only a portion of what I want to append and I'm just wondering; is there a better way then the way I'm doing it.

What I have tried:

I thought about using javascript tamplates but quickly realized that the script would not be contained within the plugin.
Posted
Comments
Karthik_Mahalingam 18-Nov-17 21:13pm    
query that portion using jquery and append it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900