I have no knowledge in jquery. can some body guide me what the below code does. I googled it but no result found. I want to add some HTML Contents inside the div whose class is
‘p-notification’. How to do this?
this.notification = $('<div/>', {
'class': 'p-notification'
});
this.content = $('<div/>', {
'class': $elem.attr("hasFooter") === "true" ? 'p-content with-p-footer' : 'well',
'style': $elem.attr("paddless") === "true" ? 'padding:0;' : '',
'text': 'Loading'
});
The following part adds or sets the
notificationproperty on the scope to be a newly createddivelement with classp-notification:The next part adds or sets the
contentproperty on the scope to be a newly createddivelement with several attributes being preset:class,style, andtext:By itself this will have no net effect on the DOM, since you have created elements but not inserted them into the document. You can insert them by using one of several methods provided by jQuery, eg
append: