Rectangle 27 0

javascript How can I hide element using jQuery?


$(document).on("change", "[name='payment_options']", function() {
  $("#trx_id").prop("type", this.value==="2" ? "text" : "hidden");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-default active">
    <input type="radio" name="payment_options" value=1 autocomplete="off" checked>Cash on Delivery
  </label>
  <label class="btn btn-default" id="bkash-radio">
    <input type="radio" name="payment_options" value=2 autocomplete="off">bKash
  </label>
</div>

<input type="hidden" name="trx_id" id="trx_id" class="form-control" placeholder="Enter Transaction ID"/>
[name='payment_options']
change
this.value==="2"
  • Than manipulate the prop type respectively
Note
Rectangle 27 0

javascript How can I hide element using jQuery?


$(document).on("change", "[name='payment_options']", function() {
  $("#trx_id").prop("type", this.value==="2" ? "text" : "hidden");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-default active">
    <input type="radio" name="payment_options" value=1 autocomplete="off" checked>Cash on Delivery
  </label>
  <label class="btn btn-default" id="bkash-radio">
    <input type="radio" name="payment_options" value=2 autocomplete="off">bKash
  </label>
</div>

<input type="hidden" name="trx_id" id="trx_id" class="form-control" placeholder="Enter Transaction ID"/>
[name='payment_options']
change
this.value==="2"
  • Than manipulate the prop type respectively
Note
Rectangle 27 0

javascript How can I hide element using jQuery?


$(document).on("change", "[name='payment_options']", function() {
  $("#trx_id").prop("type", this.value==="2" ? "text" : "hidden");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-default active">
    <input type="radio" name="payment_options" value=1 autocomplete="off" checked>Cash on Delivery
  </label>
  <label class="btn btn-default" id="bkash-radio">
    <input type="radio" name="payment_options" value=2 autocomplete="off">bKash
  </label>
</div>

<input type="hidden" name="trx_id" id="trx_id" class="form-control" placeholder="Enter Transaction ID"/>
[name='payment_options']
change
this.value==="2"
  • Than manipulate the prop type respectively
Note