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

174
Vistas
Hide payment methods based select option?

Hi i want to show show payments methods based on country option selected. i have following code.

FOR COUNTRY SELECTION

          $countries = json_decode(file_get_contents(resource_path('views/partials/country.json')));
   


<select name="country" id="countriess" class="form-control">
                         
                 <option value="nil"> -- select an option -- </option>
                        @foreach($countries as $key => $country)
                      
                            <option data-mobile_code="{{ $country->dial_code }}" value="{{ $country->country }}" data-code="{{ $key }}">{{ __($country->country) }}</option>
                         
                        @endforeach
                    </select>

To LOAD GATEWAYS

@foreach($gatewayCurrency as $data) // $data->country has country name from database

@endforeach

I have tried following using jquery

<script type="text/javascript">
           
   $('#countriess').on('change',function(){
     if("{{$data->country}}"!=$(this).val()){
            
      $("#country_{{$data->country}}").hide();
      
        }
       else if("{{$data->country}}"== $(this).val()){
           
        $("#country_{{$data->country}}").show();
        
        }
else if("{{$data->country}}"!=$(this).val()){
            
      $("#country_{{$data->country}}").hide();
      
        }
    });

        
        </script>

but issue is shows some other countries gateways as well if they are 2nd last in database

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

0

Thanks for questioning here. Below is the answer:

  1. First add the payment_methods class in the payment methods element
  2. Then add the below javascript code
$('#countries').on('change', function(){
  let countryId = $(this).val()  // get selected country id
  $('.payment_methods').hide();  // hide the all payment methods
  $("#country_" + countryId).show(); // then show payment methods for selected country id
});

Thanks!

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