Introduction
In this article, I will create an application to increase or decrease the numbers using events in backbone.js. Here, we create two buttons; one is to increment the numbers, and the other is to decrement the numbers.
We need to add these script files.
Now, we will create the application.
Step 1
- Start Visual Studio 2013.
- From the Start window, select "New project".
- Select "Installed" -> "Template" -> "Visual C#" -> "Web" -> "Visual Studio 2012"and select "ASP.NET" Web Application.
![create Web Application]()
- Click on the "OK" button.
Step 2. Now, add an HTML page to the project.
- In the Solution Explorer.
- Right-click on the project and select "Add" -> "HTML page".
![create Web Application]()
- Change the name of the page.
![Change Name of the Page]()
- Click on the "OK" button.
Add the following code.
In the code above, we declare two buttons; one is for increasing the value, and the second is for decreasing the value.
Step 3. Now, we add a JavaScript file.
- In the Solution Explorer.
- Right-click on the project, then select "Add" -> "New Item" -> "JavaScript".
![Add javascript file]()
- Click on the "Add" button.
Add the following code.
Step 4. Execute the application. Two buttons will be displayed, as shown below.
![Display two buttons]()
When we click on "Click for Increase Number" then the number will be increased.
![Increase Number]()
If we click on the "Click for Decrease Number" then the number will be decreased.
![Decrease Number]()