asp.net - Changing values of elements in view in MVC using jquery -
i have label
@html.label("getcheckboxdetail", new { @style = "display:none" , id = "checkboxdetailflag" , name = "getcheckboxdetail" })
in javascript trying change it
$(".lrequiredclass").live("click", function (event) { if ($(".lrequiredclass").is(":checked")) { $("#checkboxdetailflag").val("lrequired true"); } else { $("#checkboxdetailflag").val("lrequired false"); } });
and in controller request["getcheckboxdetail"]
returning null, after value changed in label
use .text()
instead of .val()
. change value text label use text()
$("#checkboxdetailflag").text("lrequired true");
actually code be
if ($(".lrequiredclass").is(":checked")) { $("#checkboxdetailflag").text("lrequired true"); } else { $("#checkboxdetailflag").text("lrequired false"); }
Comments
Post a Comment