Last Updated: February 25, 2016
·
303
· michalkow

HTML prototyping

Sometimes I like to do a site prototype in pure HTML, especially when I am not sure what type of language of framework I will use for the project.
I don't want to use any big templating system, instead I use this simple (jQuery) trick:

$('body').on('click', 'a', function(e) {
    e.preventDefault();
    $('#content').load($(this).attr('href'));
});

Script will just load html into my #content div from html files.
Two thing to be aware of though:

  • every <a> link will be affected, you can change it to custom class if you use <a> tags for other things.

  • some browsers might have problem loading local files like that, due to same-origin policy.