special character mailto body - javascript

The first paragraph displays the special characters (é, à)
But the second does not take them into account.
Do you have any idea where it could come from?
enter image description here
enter image description here
enter image description here

Related

vue3.2+js+elementplus,validate data occur warning

enter image description here
enter image description here
enter image description here
Why this warning occurrs and how to resolve it?

How to prevent Voice Over from reading unaffiliated HTML text (next div)?

I have an issue where drilling down into a text field with Control+Option+Shift+Down ends up reading more than what's currently inside of the text field. The Voice Over utility is concatenating an unaffiliated div, and I'm not sure if there's a way that I can specify a boundary. I don't want to read "Date Of Birth" when they're only editing the "Preferred Name" (see second screenshot)

Required "#" mark in email input field

I just have one quick question, how do I check if my input contains some mark, like "#"?
I can submit my form under 5 conditions and one of them is that my email input has to contain "#" mark, but I can't find any info how to do this!
You could use
inputValue.indexOf('#')
See here for more details
http://www.w3schools.com/jsref/jsref_indexof.asp

Regular expression for email id to avoid email input in a textfield

Problem: I am having a textarea in which I want to restrict users from entering their email id. So,that when they type email id the text area should turn red and pop-up a message saying "you can't enter your email address in this field".
My solution: Here is the simple HTML code for textarea:
<textarea class="replyToClient" placeholder="Message"></textarea>
I am currently using the below mentioned javascript code to detect email id and replace it with NULL.
<script type="text/javascript">
//EMAIL ID DETECTION AND REPLACEMNET
$(function() {
$(".replyToClient").change(function() {
$(this).val( function(idx, val) {
return val.replace(/\b(\w)+\#(\w)+\.(\w)+\b/g, "");
});
});
});
</script>
What this does is replaces something like "example#gmail.com" written in textarea with blank.
Expectation: I am trying to build a strong regexp here so that I can detect email id in any form such as "example#gmail" or "example at the rate gmail dot com" and then (the easy part)replace it from the textarea or come up with a pop-up.
So, my concern is mainly on the regular expression to detect email id in it's original format and also in the possible broken formats as mentioned above.
A bit of update to Roberts answer. The regex shown does not process dashes, underscores and dots are not taken accout for, which are standard for e-mails, as well as england based e-mails (.co.uk)
This is important for the first word. john-wick#gmail.com and john-wick at gmail dot com will respectively result in wick#gmail.com and wick at gmail dot com, leaving unwanted words in your text area. Try:
[A-Za-z0-9.\-\_]*?#\w+(\.\w+)?(\.\w+)?|[A-Za-z0-9.\-\_]*? at \w+ dot \w+( dot \w+)?
The regex seems to work for all the mentioned possibilities as john-wick#gmail.com, john-wick at gmail dot com and john-wick#example.co.uk, john-wick at example dot co dot uk.
If there are other broken formats people tend to write their e-mails, they should probably be dealt with one at a time.
give this a shot:
val.replace(/\w+#\w+(\.\w+)?|\w+ at \w+ dot \w+/ig, "");
Cheers

Autofill some words in a text field when a particular image is clicked

I know how to make a text field in HTML. But what i want is this: I have a text field, and five images below it. If a user clicks first image, the word "p1" should be automatically written in the text field. If the user clicks the second image, the word "p2" should be written and so on uptil "p5". The user is free to click any image any number of times. He can also type using his keyboard and alternately click on the images.
So how do I make this autofilling of "p1", "p2", etc. happen when the user clicks an image?
EDIT:
Suppose the first image is:
<img src="image1.jpg" alt="p1" onclick="write('p1')">
So what should be written in the body of the function write() to achieve the task?
Try
function write(text){
document.getElementById("textFieldId").value += text;
}

Categories

Resources