Calling a button with javascript is simple using document.getbyID but how do u do it with no id

Posted by Preson under ASP.NET MVC on 7/29/2014 | Points: 10 | Views : 646 | Status : [Member] | Replies : 1
View

@model ForPreson.Models.Game_Calculations

<script src="~/js/jquery.min.js" type="text/javascript"></script>
@using (Html.BeginForm())
{
<div class="editor-field">
@for(int i=0;i<1;i++)
{
String playerFifty = "player1" +"Fifty";
String playerHundred = "player1" + "Hundred";
String playerTwoHundred = "player1" + "TwoHundred";

<br />

<input id="B1" type="submit" value="50" name="@playerFifty" />
<input type="submit" value="100" name="@playerHundred"/>
<input type="submit" value="200" name="@playerTwoHundred"/>

}
</div>


}


Calling a button with javascript is simple using document.getbyID but how do u do it with no id
The above code subtracts values from the database chip tally as the buttons are pressed but when I use an onclick event the db functionality crashes help please




Responses

Posted by: Dotnet_EVIL on: 8/1/2014 [Member] Starter | Points: 25

Up
0
Down
Hello,

When it is pure html, you can work with the "id" of the html element, but when it is associated with ASP.Net/ASP.Net MVC, work with the "name" of the html element instead of the "id".


Thanks.

Preson, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response