如何动态更改html助手的样式,因为在进行语言更改时,每种语言的字体大小都不同,所以如何动态更改样式
@Html.LabelFor(u => u.username)
@Html.TextBoxFor(u => u.username)
@Html.ValidationMessageFor(u => u.username)
@Html.LabelFor(u => u.username)
@Html.TextBoxFor(u => u.password)
@Html.ValidationMessageFor(u => u.password)
提前致谢
答案 0 :(得分:0)
我认为你要找的是这样的:
@Html.LabelFor(u => u.username, new {@class = "my-class"});
...
<style>
.some-language {font: 1em;}
.another-language {font: 2em;}
</style>
<script>
("#someButton").click(function(){
$(".my-class").addClass("some-language");
})
...
</script>