Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
The placeholder value of a text box is not changing to original value?

I have a cshtml/razor html file where in there is a text box which has a placeholder value.The placeholder values change based on the radio button which the user clicks.Eg if the user selects the radio button hotel,then the placeholder value will set to "Please enter the city" and if the user click "air" radio button the value of place holder is set to "Please enter the airport".Once i keep moving from various radio buttons the value of place holder chnages and ultimately the value of place holder which comes at time of air radio button gives value of other radio button place holder

@Html.TextBoxFor(m => m.airTravelComponentSubRequestOneWay.DepartureAirport, new { @placeholder = @Resource.CityAirport, @id = "SearchViewModels_airTravelComponentSubRequestRoundTrip_DepartureAirport", @class = "search-element-master small-12 pad10", autocomplete = "off" })

This is the html for the text button

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can try to use js to change the placeholder:

<input type="radio" id="hotel" value="hotel"  name="type"/>hotel
<br />
<input type="radio" id="air" value="airport" name="type"/>air
<br />
<input type="radio" id="other" value="other" name="type"/>other
<br />
@Html.TextBoxFor(m => m.airTravelComponentSubRequestOneWay.DepartureAirport, new { @placeholder =  @Resource.CityAirport, @id = "SearchViewModels_airTravelComponentSubRequestRoundTrip_DepartureAirport", @class = "search-element-master small-12 pad10", autocomplete = "off" })

js:

$("input[name='type']").click(function () {
            var placeholder = "Please enter the " + $(this).val();
            $("#SearchViewModels_airTravelComponentSubRequestRoundTrip_DepartureAirport").attr("placeholder", placeholder);
            
        });

result:

enter image description here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda