javascript - Make a placeholder % sign pretend to stay -


this peculiar question but, have input field, this,

<div class="<?php if(form_error('interest')!= null){echo ' has-error';} ?>">    <h4><?php echo lang("offer_of_intrest"); ?></h4>    <input class="form-control" type="text" value="<?php echo set_value('interest'); ?>" placeholder="1%" name="interest"> </div> 

where placeholder says 1%, input accepts whole numbers ( 1 or 2 or 3 on.. ) , want somehow keep percentage sign inside place holder make user enter number keeping percentage sign , on submit of button number should go , not percentage sign. since in mysql accepts decimal places. giving user fake percentage sign in placeholder dont confused , enter 1( percent) in input field. , hope understand able.

since seem using bootstrap, i'd remove % placeholder , use input-group , input-group-addon:

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet" />  <div class="row">    <div class="col-xs-9">      <form class="form-inline">        <div class="form-group">          <label class="sr-only" for="exampleinputamount">percentage:</label>          <div class="input-group">            <input class="form-control" type="text" placeholder="1" name="interest">            <div class="input-group-addon">%</div>          </div>        </div>      </form>    </div>  </div>


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -