0

I have two form fields.if clicked the text from <div class="offer-text"> RS.750/- </div> the RS.750/- could be appear in the button. since I am new to bootstrap. Can anyone help me to do this?

<div class="col-sm-12">
  <div class="col-sm-3"></div>
  <div class="col-sm-6">         
    <form  method="POST" action="information.php">
      <div class="">
        <button type="submit" name="submit" class="button button-block"/>SEND</button>
      </div>
    </form>
  </div>
  <div class="col-sm-3"></div>
</div>

<div class="col-sm-12">
  <div class="col-sm-3"></div>
  <div class="col-sm-6">
    <div class="form2"> 
      <div class="row">
        <div class="column">
          <div class="offer-text"> RS.750/- </div> 
        </div>
      </div>
    </div>
  </div>
</div>
<div class="col-sm-3"></div>
2
  • You want RS.760 to replace the word SEND`? Commented Nov 5, 2017 at 13:01
  • ya. that what i need?
    – NewBie
    Commented Nov 5, 2017 at 13:05

1 Answer 1

1

To send the value to the form button use the following code:

$(".offer-text").click(function() {
  $("form button[type=submit]").text($(this).text())
})

demo

$(".offer-text").click(function() {
  $("form button[type=submit]").text($(this).text())
})

$("img").click(function() {
  $("form button[type=submit]").text($(this).attr("value"))
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-sm-12">
  <div class="col-sm-3"></div>
  <div class="col-sm-6">
    <form method="POST" action="information.php">
      <div class="">
        <button type="submit" name="submit" class="button button-block" />SEND</button>
      </div>
    </form>
  </div>
  <div class="col-sm-3">
  </div>
</div>


<div class="col-sm-12">
  <div class="col-sm-3"> </div>
  <div class="col-sm-6">
    <div class="form2">
      <div class="row">
        <div class="column">
          <div class="offer-text"> RS.750/- </div>

        </div>
      </div>
    </div>
  </div>
  <div class="col-sm-3"></div>
</div>

<img src="img/Sar Utha Kay Jeo.png" alt="IMG" style="width:100%" value="RS.1750/-" class="hover-shadow cursor"> 

3
  • brother is there any way to show the img value to that button?
    – NewBie
    Commented Nov 5, 2017 at 13:53
  • <img src="img/Sar Utha Kay Jeo.png" style="width:100%" value="RS.1750/-" class="hover-shadow cursor"> if i used img instead of the text..
    – NewBie
    Commented Nov 5, 2017 at 13:54
  • 1
    I´ve opdated the snippet Commented Nov 5, 2017 at 13:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.