I have been scratching my head for hours trying to solve this problem. I have tried most codes out there regarding this question and have not succeeded in getting a proper guide and answer to working with @html.dropdown. I have a dropdown which gets value from controller ViewBag.
public ActionResult FindBirthStones()
{
ViewBag.birthstones = new SelectList(dbcontext.GemStoneByMonths, "GemStoneByMonthId", "EnglishZodiac");
return View();
}
and in my View I have written.
@Html.DropDownListFor(m=>m.EnglishZodiac,(SelectList)ViewBag.birthstones, new { @id = "hello" })
I have tried @html.dropdownlist instead of listfor.
@Html.DropDownList("EnglishZodiac", (SelectList)ViewBag.birthstones, new { @id = "hello" })
and I want to get the selected value from the dropdownlist or listfor using jquery. I have tried most answers which are
var a= $("hello").text()
var a= $("hello option:selected").text()
var a= $("hello :selected").text()
and none of them work. Can someone please help me with it.