Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to use jQuery Timepicker in mvc 3?
    primarykey
    data
    text
    <p>Until my brain get bleeding, still I can't solve this problem. I have to use jQuery timepicker on my textbox in mvc3-View. </p> <p>Inside my <code>Layout.cshtml</code> </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;@ViewBag.Title&lt;/title&gt; &lt;link href="@Url.Content("~/Content/titoms.css")" rel="stylesheet" type="text/css" /&gt; &lt;link href="@Url.Content("~/Content/themes/base/jquery-ui-1.8.16.custom.css")" rel="stylesheet" type="text/css" /&gt; &lt;link href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")" rel="stylesheet" type="text/css" /&gt; &lt;script src="@Url.Content("~/Script/jquery-1.7.1.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Script/jquery-ui-1.8.16.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Script/jquery-ui-timepicker-addon.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;!--[if !IE 7]&gt; &lt;style type="text/css"&gt; #wrap {display:table;height:100%} &lt;/style&gt; &lt;![endif]--&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="wrap"&gt; &lt;div id="main"&gt; &lt;div id="tabs"&gt; &lt;ul id="menu"&gt; &lt;li id="menu-first-item"&gt; @Html.ActionLink("Home", "Index", "Home")&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="render"&gt; @RenderBody() &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Inside the <code>Create</code> View: </p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('#WorkDuration').timepicker({}); }); &lt;/script&gt; &lt;div id="page-title" class="text-indent"&gt; &lt;h2&gt; Create new shift&lt;/h2&gt; &lt;div id="Optiontab"&gt; @Html.ActionLink("Browse", "Index") &lt;/div&gt; &lt;/div&gt; @using (Html.BeginForm()) { @Html.ValidationSummary(true) &lt;div class="fieldset"&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.WorkDuration) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.TextBoxFor(model =&gt; model.WorkDuration) @Html.ValidationMessageFor(model =&gt; model.WorkDuration) &lt;/div&gt; &lt;/div&gt; } </code></pre> <p>The id of the textbos is "WorkDuration". The timepicker doesn't show. Now, what I've missed? Hope someone could help. Thanks! </p> <p>**</p> <h2>EDIT</h2> <p>** </p> <p>I've found the answer, this should work now: </p> <p>Inside <code>layout.cshtml</code> </p> <pre><code>&lt;head&gt; &lt;title&gt;@ViewBag.Title&lt;/title&gt; &lt;link href="@Url.Content("~/Content/titoms.css")" rel="stylesheet" type="text/css" /&gt; &lt;link type="text/css" href="@Url.Content("~/Content/jquery-ui-titoms.css")" rel="stylesheet" /&gt; &lt;style type="text/css"&gt; #ui-datepicker-div, .ui-datepicker{ font-size: 80%; } .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } .ui-timepicker-div dl { text-align: left; } .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } .ui-timepicker-div td { font-size: 90%; } .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; } &lt;/style&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery-ui-1.8.16.custom.min.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery-ui-timepicker-addon.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery-ui-sliderAccess.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { $("#WorkDuration, #AbsentTrigger, #LateTrigger, #StartTime, #EndTime").timepicker({ addSliderAccess: true, sliderAccessArgs: { touchonly: false }, showSecond: true, timeFormat: 'hh:mm:ss' }); }); &lt;/script&gt; &lt;!--[if !IE 7]&gt; &lt;style type="text/css"&gt; #wrap {display:table;height:100%} &lt;/style&gt; &lt;![endif]--&gt; &lt;/head&gt; </code></pre> <p>Reference: </p> <p><a href="https://stackoverflow.com/questions/8997914/jquery-timepicker-theme-is-not-working/8998127#8998127">Timepicker theme not working</a></p> <p>Thanks for all responses!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload