JSFiddle - React, Tailwind, and code Playground
HTML
<div id="someDiv">
<p>Starting Content</p>
</div>
<button id="getMore">Get more content</button>
<div id="capa">
</div>
JavaScript
$.fn.getMoreContent = function()
{
var collection = this;
$.ajax( {
url: '/echo/html/',
type: 'POST',
dataType: 'html',
data: {
html: '<p>More content</p>',
delay: 1
},
success: function( data )
{
collection.append( data );
}
} );
return collection;
};
$( '#getMore' ).click( function( e )
{
$( '#someDiv' ).getMoreContent().css( 'color', '#f00' );
e.preventDefault();
$("#capa").load("https://www.barcodelookup.com/9784757511552 #img_preview");
} );