Reputation: 21
<div class="external-event bg-red-gradient text-center" style="position: relative;">
<div id="@wo.id" class="WoOrders">
@Html.DisplayFor(modelItem => wo.id) --
@Html.DisplayFor(modelItem => wo.warehouse_number) --
@Html.DisplayFor(modelItem => wo.warehouse_order_number) --
@Html.DisplayFor(modelItem => wo.warehouse_process_type) --
@Html.DisplayFor(modelItem => qu.QueueId)
</div>
</div>
How could i call the id of that div-element (i've tried getElementById() without success).
Thanks in advance.
(Newbie :))
Upvotes: 0
Views: 25
Reputation: 218807
This is server-side code in ASP.NET:
@wo.id
It's not what gets rendered to the actual client-side. That would be whatever the value of wo.id
is. So, for example, if the value is "someIdentifier"
then you'd have this:
<div id="someIdentifier" class="WoOrders">
In which case you'd identify that element in JavaScript with:
var element = document.getElementById('someIdentifier');
Upvotes: 1
Reputation: 1616
You need to escape the @ symbol with '\@wo.id' in your call.
https://jsfiddle.net/mw864znm/
document.getElementById('\@test').className= "red";
Upvotes: 0