javascript - Check whether checkbox is checked or not in page load itself by jquery -
I have the .NET MVC 3 page under the checkbox and the Span tag,
@Html ("id", "CBAcDeStats7"}, {"class", "onchange"}}). (Checkbox) & lt; Span id = "spBlueCheckbox" style = "display: none; color: blue;" & Gt; Some messages & lt; / Span & gt; Jquery:
jQuery (function ($) {$ ('# cbCheckedStatus7'). ('Change', function () {$ ( '#spBlueCheckbox') Slide Toggle (this.checked);}); If the checkbox is checked, then I have to show a span tag or hide it. The tag is hidden.
I have written jquery to do the above scenario, but it is working only when I manually click with the mouse.What do I want, when I Navigate to this page from the page, the checkbox is checked by the default based DB flag, but the span tag is not shown.
Call below the jquery on page load: ($ '(': 'check)):
$ (document) .ready (function () {// preliminary Check and show / hide if ($ ('$ cbCheckedStatus7'). {// Check that checkbox $ ('# spB checksbox') is checked. Show ();} / / replace handler $ ('# cbCheckedStatus7 '). ('Change', function () {$ ('# spBlueCheckbox') .slideToggle (this.checked);});});
Comments
Post a Comment