> For the complete documentation index, see [llms.txt](https://javascriptuse.gitbook.io/advanced/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascriptuse.gitbook.io/advanced/backbone.js-tutorial-8-views-creating-new-html-elements-ok.md).

# Backbone.js Tutorial - 8 - (Views) Creating New HTML Elements (ok)

Thêm một thẻ trong một thẻ cha :)

![](https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1E4Gk2ppVKb4olmnun%2F-MS30Jaem4nyxQgmeNfB%2F-MS31yVIU2yJQKSwEX0p%2FScreenshot_3.jpg?alt=media\&token=90bf80be-8fb6-48f2-b4d4-d30305869cbc)

C:\Users\Administrator\Desktop\gulp\app.js

```
var theView = Backbone.View.extend({
	tagName: 'p',
	className: 'classspan',
	id: 'idspan',
	initialize: function() {
		this.$el.html("Hello World");
	}
});
jQuery(document).ready(function($) {
	var page = new theView();
	$('#div1').html(page.$el);
});
```

![](https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1E4Gk2ppVKb4olmnun%2F-MS1VtkL-1qDdwEW2yVl%2F-MS1XVCENAezB_N4dWP1%2FScreenshot_6.jpg?alt=media\&token=fd5d1197-a82f-4141-9b5c-61285c0a8b89)

C:\Users\Administrator\Desktop\gulp\app.js

```
var theView = Backbone.View.extend({
	tagName: 'span',
	className: 'classspan',
	id: 'idspan',
	initialize: function() {
		console.log(this.el);
		console.log(this.$el);
	}
});
jQuery(document).ready(function($) {
	var page = new theView();
});
```

C:\Users\Administrator\Desktop\gulp\app.js

```
var theView = Backbone.View.extend({
	tagName: 'span',
	className: 'classspan',
	id: 'idspan',
	initialize: function() {

	}
});
jQuery(document).ready(function($) {
	var page = new theView();
	$('#div1').html(page.$el);
});
```
