Display balloon popup on a label

Asked

Viewed 685 times

1

I would display a small message to the user, style those when passing the mouse, if I am not mistaken would be the attribute

alt="my message"

however I am using Asp.net-mvc-5 and I am finding it difficult to do. My message, I would like it to appear on @Html.Labelfor, and also wanted it to be a fixed message, I believe that with CSS, jquery or javascript I can do, but I couldn’t find anything that would help me.

<div class="form-group">
    @Html.LabelFor(model => model.Celular, htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-10">
          @Html.EditorFor(model => model.Celular, new { htmlAttributes = new { @class = "form-control celular", id = "txt-tel" } })
          @Html.ValidationMessageFor(model => model.Celular, "", new { @class = "text-danger" })
    </div>
</div>

1 answer

1


What you want is a Tooltip. There are several libraries that do this. Possibly you want some that behave like this one.

Tooltips are in JS, so they are independent of ASP.NET MVC. Use is done as follows:

<span class="tooltip" onmouseover="tooltip.pop(this, 'Este é meu texto na tooltip.')">
    Exemplo de texto com Tooltip
</span>
  • When I assign the tooltip class my content is hidden

  • See the examples on the site I passed. There are more examples of use.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.