Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minus sign in RTL textbox

Tags:

html

css

How can I display negative numbers in right to left textbox, with the minus on the left of the number?

Current state: 1-
Desired state: -1

like image 941
gdoron is supporting Monica Avatar asked Dec 08 '11 08:12

gdoron is supporting Monica


1 Answers

On your textbox you just need to reset the direction, and align the text to the right:

BODY {
  direction: rtl;
}

#test {
  direction: ltr;
  text-align: right
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>
  Lorem ipsum dolor sit amet consectetuer adipiscing elit. Lorem ipsum dolor sit amet consectetuer adipiscing elit. Lorem ipsum dolor sit amet consectetuer adipiscing elit. Lorem ipsum dolor sit amet consectetuer adipiscing elit.<br />

  <input type="text" id="test" value="-109309" />
</div>
like image 193
Rory McCrossan Avatar answered Oct 12 '22 00:10

Rory McCrossan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!