Home > Enterprise >  Trying to put an "€" sign into a input - but no luck
Trying to put an "€" sign into a input - but no luck

Time:09-04

I'm trying to put a euro sign inside an input but despite everything, I can't get it to work.

It's a plugin that display a slider for a form, I tried to add a div to contain this input inside the plugin file, but it doesn't work either.

Here's what I tried, but I'm not sure if it can work this way with javascript

var input = $( "#input_1_30" );
input.val( input()   "€" );
<div ><input name="input_30" id="input_1_30" type="number" step="500" min="0" max="250000" data-value-visibility="show" data-connect="lower" value="25000"  data-min-relation="" data-max-relation="" data-value-format="decimal_dot">

Thanks

CodePudding user response:

As I said in my comment, I used HTML text input field with currency symbol

<label>€
    <input name="input_30" id="input_1_30" type="number" step="500" min="0" max="250000" data-value-visibility="show" data-connect="lower" value="25000"  data-min-relation="" data-max-relation="" data-value-format="decimal_dot">
</label>

This isn't a job for JS. Place the € next to the form input in html and style it accordingly using CSS.

CodePudding user response:

I am not entirely sure what you want to do but what you can do is add the euro sign as a placeholder in the input field but it will disappear after a user adds their earnings.

If you still want add it in the placeholder attribute, you can do this in the input tag

<input placeholder="€"/>

I hope this helped and if you want to know more about placeholders and input tags you can check W3School

  • Related