I am trying to wrap a div around a block of html on a screen width of less that 641px. Here is the code:

if ($(window).width() < 641) {
	$('.basket').wrap('<div id="myModal" class="reveal-modal" data-reveal>');
I am trying to wrap it with the Zurb Foundation Modal plugin but i only want it on small screen sizes. After i have done the wrap the jQuery doesn't function. Is their some way of attaching a jQuery trigger like this and then have it function normally as if it was just loaded directly in the html? Maybe using .on()?