JSFiddle - React, Tailwind, and code Playground

by Mottie

HTML

<div id="twitter">...</div>
<iframe id="iframe" src="http://fiddle.jshell.net/Mottie/baEb9/show/"></iframe>

JavaScript

$(function () {
    // define this here because we're changing the ID
    var $twitter = $('#twitter');
    // bind to select inside iframe
    $('#iframe').on('load', function () {
        $(this).contents().find('#cds').change(function () {
            var selectVal = $(this).val();
            url = 'https://twitter.com/intent/tweet?button_hashtag=stream&text=Just enjoying ' + selectVal + ' on';
            $twitter.attr("id", url).text(url);
        }).change(); // trigger change to get initial value
    });
});