I want to see an element only when the value of the second element is not empty.
I'm using this now:
set function Resize SMS notification checkbox area (var {/ checkbox = $ ('# ReceiveSmsNotifications'); Var values = !! $ ('# Cellphone') Val (). Trim (); // bool txt val depends on checkbox.prop ('check', value); ('Form-group'). Checkbox.closest toggle (value); } $ ('# Cellphone'). Change (function () {setReceiveSMSNotificationsCheckboxArea ();}); $ (Document) .ready (setReceiveSmsNotificationsCheckboxArea);
Is there two types of tasks to be linked together (so that the change also runs on startup?)
You can trigger the event of change on page load to trigger the handler
function setreceiveSmsNotificationsCheckboxArea () {var checkbox = $ (' #ReceiveSmsNotifications'); Var values = !! $ ('# Cellphone') Val (). Trim (); // bool txt val depends on checkbox.prop ('check', value); ('Form-group'). Checkbox.closest toggle (value); } $ ('# Cellphone'). Change (setReceiveSmsNotificationsCheckboxArea) .change ();
No comments:
Post a Comment