JSFiddle - React, Tailwind, and code Playground
by Taylor Evanson
HTML
<script src="http://j-ulrich.github.com/jquery-simulate-ext/jquery.simulate.js"></script>
<a href="http://google.com" class="site">http://google.com</a><br />
<a href="http://gmail.com" class="site">http://gmail.com</a><br />
<a href="http://linkedin.com" class="site">http://linkedin.com</a><br />
<a href="http://facebook.com" class="site">http://facebook.com</a><br />
<br /><br />
http://site.com/<input type="text" id="launcher" />
<button id="trigger" type="submit" class="btn btn-primary">Launch</button>
<section class="store">
</section>
JavaScript
function clickLink(link) {
var cancelled = false;
if (document.createEvent) {
var event = document.createEvent("MouseEvents");
event.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0,
false, false, false, false,
0, null);
cancelled = !link.dispatchEvent(event);
//link.trigger(event);
}
else if (link.fireEvent) {
cancelled = !link.fireEvent("onclick");
}
if (!cancelled) {
window.location = link.href;
}
}
jQuery("#trigger").bind("click", function(){
jQuery("a.site").each(function(){
var string = jQuery(this).attr("href") + "/" + jQuery("#launcher").val();
//jQuery(this).attr("href",string);
//clickLink(jQuery(this));
jQuery('section.store').append('<a target="_blank" href="'+ string +'" class="tempa">link</a>');
jQuery('.tempa').simulate('click');
jQuery('.tempa').remove();
});
});