MVC-How to put Tool Tip in the TextBox, DropDownBox, CheckBox using jQuery

Step1

We need to put plugin in the cshtml page

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" temp_href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />

<script src="http://code.jquery.com/jquery-1.8.3.js" temp_src="http://code.jquery.com/jquery-1.8.3.js"></script>

<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js" temp_src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>


Step2

Also we need to add the scripts int eh Cshtml page.

<script>

        $(document).ready(function () {

            $("#txtname").tooltip({ track: true });

            $("#ddlcategory").tooltip({ track: true });

        });

</script>

Step 3

  • @Html.TextBoxFor(model => model.Net_Amount, new { @title = "Please enter the total income.", @id = "txtname" })
  • @Html.DropDownListFor(modelitem => modelitem.CategoryId, new SelectList(ViewBag.Categories, "CategoryId", "CategoryName"), new { @title = "Please select the category for your budget.", @id = "ddlcategory" }