-2
I would like to disable the textarea if select is false, and enable if select is true. I was trying to do for DOM, but I did not succeed, below this code I have, in case someone can help me.
<div class="row">
<div class="col-sm-12 col-lg-6">
<div class="form-group">
<label>Banner Ad:</label> <i class="fa fa-info-circle" data-toggle="tooltip" title="Enable or disable Banner Ad"></i>
<select name="controls" class="form-control">
<option <?php if($list_settings['controls'] == 'true') echo 'selected' ?> value="true">Enabled</option>
<option <?php if($list_settings['controls'] == 'false') echo 'selected' ?> value="false">Disabled</option>
</select>
</div>
</div>
<div class="col-sm-12 col-lg-12">
<div class="form-group">
<label>Ad Code:</label> <i class="fa fa-info-circle" data-toggle="tooltip" title="Enter your ad code here"></i>
<textarea name="banner_ad_code" class="form-control" value=""></textarea>
</div>
</div>
<div class="col-sm-12 col-lg-4">
<div class="form-group">
<button type="submit" name="upgrade" class="btn btn-primary btn-sm">Save Settings</button>
</div>
</div>
</div>
right, but I did not understand very well how I would disable the textarea if the value of select were in false, could help me please
– LeandroFalasca 1
@Leandrofalasca1 You enter a show() or Hide() in the text area, e.g. $("#idTextArea"). Hide() (this command will hide the textarea). So inside the if I put an example you put a . show() and in the if Else you would put . Hide() in the textarea element. Documentation: https://www.w3schools.com/jquery/jquery_hide_show.asp
– Vinicius Gabriel