Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

188
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda