Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
AlpineJs extract a specific value from select[option]

Assume I have a table services with columns:id,name,price and I have made select box in some blade page, and I want to extract a price from that selectbox options.

 <select  x-model="service.service"
                                
    name="services[]" 
     class="input rounded-sm">

                            <option   >-- choose service --</option>
                            @foreach ($services as $service)

                                <option x-init="x={{number_format($service->price, 2)}}" value="{{$service->id}}">
                                    {{ $service->name }} (${{ number_format($service->price, 2) }})</p>
                                </option>
                            @endforeach
                        </select>

this code retrives only the last price from the select? it print "Unit Price: 855" and stack on that value.

I want the text change when selecting diffrent value

please dont mention:

value ={{service->prie}}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!