Во-первых, вам не хватает типа документа html5, который реализован так
<!DOCTYPE html>
вверху документа.
тогда вам нужно добавить готовый документ!
$(document).ready(function(){
//The code here runs when the document is fully loaded into the DOM.
//Create a blank rect, add its attributes
the_box = $("<rect/>")
.attr('x','100px').attr('y','0px')
.attr('height','100px').attr('width','100px')
.attr('fill','red');
//Append the jQuery variable to the selector.
$('svg[viewbox]').append(the_box);
});
Пройди.