Skip to content

Instantly share code, notes, and snippets.

@rpgmaker
Last active December 16, 2015 05:29
Show Gist options
  • Save rpgmaker/5385103 to your computer and use it in GitHub Desktop.
Save rpgmaker/5385103 to your computer and use it in GitHub Desktop.
Razor JS
<script type='text/javascript'>
var Html = (function(){
var content = jQuery('<div>');
function _write(html){
content.append(html);
}
function _clear(){
content.html('');
}
function _flush(){
jQuery(document).append(content);
}
return {
Write: _write,
Flush: _flush
};
})();
(function(){
Html.Write('
<span>Testing</span>
');
Html.Write('<span data-id=\'_1\'></span>');
function _1(){ return Button.Create('Testing').Render()
; }
jQuery("span[data-id='_1']").html(_1());
Html.Write('
<span>');
Html.Write('<span data-id=\'_2\'></span>');
function _2(){ return Test('ok'); }
jQuery("span[data-id='_2']").html(_2());
Html.Write('<');
Html.Write('/span>
<br/>
<span>');
Html.Write('<span data-id=\'_3\'></span>');
function _3(){ return MM; }
jQuery("span[data-id='_3']").html(_3());
Html.Write('<');
Html.Write('/span>
');
}).apply(Html)();
Html.Flush();
</script>
<span>Testing</span>
@Button.Create('Testing').Render()
<span>@Test('ok')</span>
<br/>
<span>@MM</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment