JSFiddle - React, Tailwind, and code Playground

by williamdaburke

HTML

<div id='div1'></div>
<button id="myButton">Button</button>
<button id="myButton2">Button2</button>
<iframe id="editor-iframe" width="200" height="200" frameborder="0"></iframe>

JavaScript

var datagh
$.getJSON('http://www.whateverorigin.org/get?url=' + encodeURIComponent('http://www.comuni-italiani.it/') + '&callback=?', function(data) {
  // $("#div1").html(data.contents);
  iframe = document.getElementById('editor-iframe'),
    editorDoc = iframe.contentDocument || iframe.contentWindow.document;

  // simulating modifications to document in editor iframe
  $(editorDoc)
    .find('body').html(data.contents)
    .end();

  datagh = {
    html: $(editorDoc).find('p').get(0).outerHTML,
    css: $(editorDoc).find('head style').html(),
    metadata: {
      user: 'onur'
    },
    me1: $(editorDoc).find('b a').get(5).innerText,
    mes1: $(editorDoc).find('table.main tr td b a').map(function() {
      return this.innerText;
    }).get(),
    meRefs1: $(editorDoc).find('table.main tr td b a').map(function() {
      return this.href;
    }).get()

  };

});
$('#myButton').click(function() {
  var txt1 = datagh.meRefs1[3]
  var txt2 = txt1.split(/display\//);
  alert("http://www.comuni-italiani.it" + "/" + txt2[1])
});
$('#myButton2').click(function() {

  alert(datagh.meRefs1[3])
});