user2256404
user2256404

Reputation: 115

Allow user to enter a Euro symbol using Altgr+e in a html textbox

I have a html textbox in my webpage. I am able to enter a Euro symbol using Alt0128 in the text box, But on another keyboard , we use Altgr + e to enter the Euro symbol, But I am not able to use this combination on that keyboard to enter a euro symbol in the html textbox. Is there some attribute i need to add for the same ? this is my text box:

</td>
        <td class="contentCell" colspan="3" ">
            [#txt|txtmyBox#]
        </td>

Upvotes: 0

Views: 348

Answers (1)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201748

The effect of things like AltGr E depends on the keyboard driver (keyboard setup), not on your HTML code. You might be able to interfere using JavaScript, recognizing which keys were pressed, but this could be very risky. For all that we can now, AltGr E may have any meaning in a user’s keyboard, and making it produce something different could be very confusing (and might prevent the user from typing what he wants to type).

In principle, HTML5 drafts propose an inputMode attribute that could affect the keyboard setup, but probably only on touch screens. And it has not been implemented, and the current drafts don’t have anything related to typing currency symbols.

What you could do without disturbing keyboard settings is to add a button on the page, with “€” on it, so that clicking on that buttom appends the euro sign to the input value. This would be rather straightforward to do in JavaScript.

Upvotes: 1

Related Questions