I want to add some functionality to a button I made using the following html code:
<div>
<p style="display: inline">
Strength:  <b>@str</b>
</p>
</div>
<input class="btn btn-default" type="submit" value="Add Strength" onclick="addValue('str');"/>
When I click this button, I want to change a value I stored with Razor;
@{
int str = 5;
}
I've Googled a bit, read the documentation but I can't find anything, which works.
I made a javascript function which I called on onclick, but when I was debugging the code didn't get inside the scope of said function.
Here's the function:
function addValue(kind) {
if (ran == 0) { initialize(); }
if (left != 0) {
left--;
if (kind == "str") {
str++;
} else if (kind == "dex") {
dex++;
} else if (kind == "intl") {
intl++;
}
}
}
If anyone can explain to me how I can get some kind of function on my button I'd appreciate it.