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
How to apply the css on all ID starting with

On my website I have an AJAX search form. The HTML code displays this ID:

id="edit-field-geolocation-proximity-center-geocoder--Bq5Bx8zXA1A"

I want to apply a style to it. My problem is that the code at the end of Bq5Bx8zXA1A changes with each search.

How to style all ID starting with :

id="edit-field-geolocation-proximity-center-geocoder--"

UPDATE

Here is my current CSS code, it works on non-AJAX forms. But for those who have AJAX enabled, it doesn't work because there is a random code added to the background of the ID :

#edit-field-geolocation-proximity-center-geocoder .form-item {
    margin-top: 0rem;
}

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Welcome to Stack Overflow! I can help with that. One way to achieve what you are looking for in pure CSS is with an attribute prefix selector (which uses a form of regular expressions). In your case the following would likely do the trick:

[id^="edit-field-geolocation-proximity-center-geocoder"] .form-item {
  /* your styles here :) */
}

This thread offers a lot of additional excellent methods on how to use regex in CSS if you would like to do some additional reading.

about 4 years ago · Juan Pablo Isaza Report
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!