Set letter spacing of last character in input field - javascript

I'm currently creating an input field that requires letter spacing, but if the last letter is spaced it shifts everything out of alignment... I was just wonder if there would be anyway of finding the last character of the input field which will be the 13th character with jquery or JavaScript and setting the letter spacing to 0.
Any help appreciated.

Check out Lettering.js. It wraps characters in HTML, allowing you to manipulate them more finely with CSS.

If I understand you correctly, you are trying to trim the trailing space right??
If so you can simply trim the input field value every time it changes. Here is the JQuery solution.
$.trim(MyInput.value);

Related

How I can add spaces before and after character on HTML input

I want to add spaces in my input field after every time when I click any symbol in my keyboard,How I can do that?
You can use &ensp to insert space in HTML

Replace underscores on typing input in JavaScript

I have a text field with little dashes/underscores as shown in the image. How do I use JavaScript/backbone.js to make these dashes to be replaced by the input number upon typing?
As I type, I want the underscore to be replaced with the number I type. How do I achieve this?
Thanks in advance
input invoice field

Ways to prevent survey respondents from inputting spaces as their first character

I am basically new to html/css/javascript and I just got thrown a problematic issue.
I have a text box for my "Others, please specify" option. However, there are instances where some respondents can proceed to the next question by just entering a space and nothing else. When I download my data, the field became blank and hence more cleaning work is needed.
Just wondering if there any ways (html, css or javascript) that I can make use of to prevent my respondents from entering just spaces for the very first character. Any help would be appreciated. Thank you.
Put the required input in a form with a pattern which requires non-space characters:
<form>
<input required pattern="\S.*">
<button>submit</button>
</form>
\S.* means - match one non-space character (at the beginning of the string), followed by anything.
Consider using RegEx and use your desired pattern. In your case /[^\s]/ (matches anything that is not a whitespace character) will do.

Ignore space changes in text field widget

Is there a way to ignore the spaces in the string of the text field on the 'change' event. For example #(x) ( sin(x) )and#(x) (sin(x)) are treated as two different function strings, and a change event is triggered on text field change
The solution is to watch for the input changes in JavaScript, when it change it will have value, save it into a variable removing all the whitespaces, next time when value comes remove all the whitespaces and compare with previous string variable, if both are same Do Nothing else Do Something! you can find sample code here.
For removing whitespace used this.

PHONE VALIDATION: How To Overwrite Text In a Textbox When Typing Without Clearing Whole Field?

I would like to know how to create a script that overwrites text that is already in a text box. (in jquery or javascript)
Example: If I have a text phone field that says:
+1 (xxx) xxx-xxxx
When a user clicks the field, I want the characters to remain, and the focus set to the 4TH character in the text box, just after the 1.
Then, as a user types each number, it overwrites the x one by one, until all the x's are gone. But, I want the parenthesis and hyphen formatting to stay, so the users input forms around the formatting.
I would also like this form to only allow numbers, hyphens, and parenthesis, and not allow submitting if x's still exist.
If you can help me with this, THANK YOU! :-)
Try masked input plugin # [
http://digitalbush.com/projects/masked-input-plugin/
]1
Looks like it matches what you need.

Categories

Resources