如何将占位符放在剃刀代码上

时间:2018-04-12 09:57:43

标签: c# forms razor placeholder

我有一个HTML表单,没有连接到数据库,如下所示:

<div class="wrap-input100 validate-input" data-validate="Inserir nome">
<input class="input100" type="text" name="name" placeholder="Nome*">
<span class="focus-input100"></span>
</div>

现在我正在连接数据库,但我无法将“占位符”放在我的代码中。我试图放"Name:"但它不起作用。我不太了解这项技术,对我来说是新的。

<form class="contact100-form validate-form">
<div class="wrap-input100 validate-input" data-validate="Inserir nome">
@Html.LabelFor(m => m.CustomerFirstName, "Nome:", new { @class = "control-label" }) 
@Html.TextBoxFor(m => m.CustomerFirstName, new { @class = "input100" })
@{ Html.ValidateFor(m => m.CustomerFirstName); }

</div>

我正在使用的表单模板:https://colorlib.com/etc/cf/ContactFrom_v15/index.html

1 个答案:

答案 0 :(得分:0)

只需在Html属性中添加@Html.TextBoxFor(m => m.CustomerFirstName, new { @class = "input100", placeholder = "Nome*" }) 属性:

// Name of certificate
let certificateName = document.querySelector('.js--c-name').value;

// Call upload function
currentFileInput.addEventListener('change', fileUpload , false);

const fileUpload = (certificateName) = (evt) => {
  // Here I need the parameter certificateName for testing
  console.log(`Name of Certificate: #{certificateName}`);

  // Function stuff...
  let myFile = evt.target.files[0],
      maxFileSize = evt.target.getAttribute('data-fileSizeMax');

  // Check filesize
  if(myFile.size <= maxFileSize){
   // etc.
  }

}