I want to include some text inside a textbox (ID=button3) after pressing a button.
I have the following html:
<div id="collapse2" style="display:none">
<span id="button3">text before pressing the button></span>
</div>
And inside javascript I know I can solve my problem in two different ways.
Option 1:
var element=document.getElementById("button3");
element.innerHTML="text after pressing the button";
Option 2:
$('#button3').text('text after pressing the button');
Can you give me a 3rd option with razor/html helpers? This is related with another question I posted yesterday (My other question). However, I think this time I was able to explain my problem in a better way.
To do this entirely within razor, you will be required to make a call to the server. To do this, make your view strongly typed and take the button3 value from the model using razor.
Add an input parameter (string button3Value="initial value") to your Controller Method. Default this to your initial button3 value.
You can then use an @Html.ActionLink and pass the new button3 value from your buttonclick. This will reload the page with the appropriate value.
u can use this option