I get compile error at $(this).id)
<script>
if ('@content.ToList().Count' > 0)
{
$(".divContainer").text('@content.Where(p => p.ContainerID == `$(this).id`).Select(p => p.TextContents).First()');
}
else
{
$(".divContainer").text("Please enter the text");
}
</script>
How to add the id of 'this div' with class 'divcontainer' inside the razor code @content.Where(p => p.ContainerID == "ID".Select(p => p.TextContents).First()
question made simpler.
How to write the following code correctly
@string text = $(this).text();
Here razor variable 'text' is assigned with Jquery text value.