jQuery plugin to associate label “for” attribute with form controls that have dynamic id’s

For whatever reason, you can’t associate your labels with your form controls implicitly by wrapping both the label text and the control in a <label> element:

<label>
  Email address: <input type="email" name="email" value="" placeholder="you@example.com"/>
</label>

You’ve had to explicitly state the form control you want the label to be associated with:

<label for="email">Email address:</label>
<input id="email" type="email" name="email" value="" placeholder="you@example.com"/>

…but your framework has other ideas, it decides to commandeer your precious “id” attribute and change it from a simple and beautiful “email” into a junky “dnn_ctr1163_RegistrationForm_email”. *cough* DotNetNuke *cough*, but also *cough* Wicket *cough* and probably a whole load of others.

The problem is now that your label is no longer associated with your form control, and there isn’t a simple fix, like, for example, change the for attribute to read “dnn_ctr1163_RegistrationForm_email”, because the numbers in the id change each time you refresh the page. The ID is dynamic, and you are receiving accessibility black stars.

So, luckily I noticed that often the id will change, but the framework will leave your originally intended id somewhere in there. I’ve written a jQuery plugin to look at label for attributes and try to find the form control you intended to associate it with before your server side framework so rudely changed it.

How to use

  1. Download the plugin and add it to your page
  2. Select the labels you want to re-associate and call the function eg. $(‘label’).fuzzyFor();

TODO

The plugin finds matches by looking for input, select and textarea elements in the document and checking to see if the for attribute in your label element appears in the id attribute of the form control. At the moment if more than one match is found, it just uses the first (which is probably good enough for most). However, it should probably do something a bit more clever and use the form control that is closest to the label (I’m reasoning that you normally put your label’s close to your controls).

1,629 thoughts on “jQuery plugin to associate label “for” attribute with form controls that have dynamic id’s

  1. It is Australia’s second-largest casino, offering a vast array of gaming
    options, including poker, blackjack, and roulette, along with electronic gaming machines.
    Whether you prefer the dining table or the gaming table,
    the Casino Dollars you earn as a Member of The Star Club
    give you the freedom to enjoy more of what you love.
    It’s home to four unique hotels and residences, including Sydney’s first and only Forbes five-star boutique hotel and urban resort – The Darling.

    On November 28, 2025, USCIS announced it has stopped making any decisions on pending asylum applications.

    Under U.S. law, the government cannot deport people with pending asylum cases until their cases are adjudicated and they lose their cases.
    The push is aimed at sidestepping a core feature of U.S.
    law governing asylum cases.

    References:
    https://blackcoin.co/real-money-online-slots-in-australia-2025/

  2. Unm Pharm: buy antibiotics over the counter in mexico – Unm Pharm

  3. CT Interactive and Apparat Gaming focus more on classic-style games with modern twists.
    These smaller providers often take more creative risks, resulting in innovative features and fresh gameplay mechanics.
    They’re great for a change of pace from standard table games.
    Professional dealers run the games, and the streaming quality
    is consistently excellent.
    Can I get Richard Casino free chip codes without depositing?
    This provides access to the full A$5,000 plus 500 free spins package across five deposits.
    The standard welcome package requires no code –
    just a A$30 minimum deposit. Absolutely – Richard Casino’s legit status is confirmed through their Curacao licence and
    positive player feedback. Can I withdraw immediately after using
    a Richard casino promo code?

    References:
    https://blackcoin.co/top-online-casinos-and-games-in-new-zealand/

  4. india pharmacy mail order online shopping pharmacy india Umass India Pharm

  5. canadian pharmacy ed medications Nyu Pharm pharmacy canadian

  6. Lately I came across a helpful report regarding Canadian Pharmacy Certified Online. It details the safety protocols for generic meds. If you are looking for Trusted Canadian sources visit this link: resource. Worth a read.

  7. п»їJust now I came across a useful guide about Mexican Pharmacy standards. It details FDA equivalents for ED medication. In case you need cheaper alternatives take a look: п»їп»їclick here. Hope it helps.

  8. п»їJust now I discovered a great page regarding cheap Indian generics. It details WHO-GMP protocols on prescriptions. For those interested in cheaper alternatives take a look: п»їindia pharmacy mail order. Might be useful.

  9. If you want to save big on pills I recommend reading this report about Canadian meds. It reveals shipping costs. Discounted options at this link: useful link.

  10. п»їActually I came across a useful report concerning ordering meds from India. It explains how to save money when buying antibiotics. If anyone wants Trusted Indian sources check this out: п»їdetails. Might be useful.

  11. Quick question about getting CIPA approved pills. I discovered a good post that lists affordable options: MUSC Pharm. What do you think?.

  12. If you want to save money on prescriptions you should try reading this resource. The site explains prices for generics. Best prices at this link: п»їhttps://polkcity.us.com/# mexico pharmacy price list.

  13. Just now I came across a useful report about Canadian Pharmacy Certified Online. The site discusses how to save money for ED medication. If you are looking for reliable shipping to USA take a look: professionalinsight.us.com. Worth a read.

  14. Quick question about Canadian Pharmacy Certified Online. I discovered a decent blog that lists affordable options: professionalinsight.us.com. Check it out.

  15. Does anyone know Canadian Pharmacy Certified Online. I discovered a good site that lists safe places: professionalinsight.us.com. Seems useful..

  16. Recently I discovered an interesting article regarding safe Canadian shipping. It covers Health Canada standards on prescriptions. If you are looking for Trusted Canadian sources take a look: https://professionalinsight.us.com/# canadian pharmacy. Cheers.

  17. I was wondering about buying verified meds. I ran into a good site that lists certified vendors: adderall canadian pharmacy. Any thoughts?.

  18. п»їTo be honest I discovered a useful report about ordering meds from India. The site discusses WHO-GMP protocols on prescriptions. In case you need cheaper alternatives go here: п»їtop online pharmacy india. It helped me.

  19. п»їTo be honest I stumbled upon an interesting article about generic pills from India. It details WHO-GMP protocols when buying antibiotics. If anyone wants Trusted Indian sources go here: п»їhttps://kisawyer.us.com/# indianpharmacy com. Worth a read.

  20. For those looking to save money on prescriptions you should try visiting this archive about Canadian meds. It shows shipping costs. Discounted options at this link: professionalinsight.us.com.

  21. FYI a detailed analysis on cross-border shipping rules. It breaks down how to avoid scams for antibiotics. You can read it here: п»їhttps://polkcity.us.com/# mexican pharmacy that ships to the us.

  22. If you want to save on pharmacy costs I suggest visiting this resource about Canadian meds. It reveals trusted Canadian pharmacies. Best prices found here: https://professionalinsight.us.com/# vipps approved canadian online pharmacy.

  23. Stop overpaying and save money on prescriptions I recommend checking this report about Canadian Pharmacy Certified Online. It reveals shipping costs. Best prices found here: MUSC Pharm.

  24. Quick question about ordering meds from Mexico. I saw a verified archive that lists safe places: п»їpolkcity.us.com. Seems useful..

  25. Actually I stumbled upon an informative report regarding Canadian Pharmacy Certified Online. It explains how to save money for ED medication. If anyone wants cheaper alternatives go here: https://professionalinsight.us.com/# canada pharmacy reviews. Worth a read.

  26. п»їRecently I came across a helpful article regarding Indian Pharmacy exports. It covers the manufacturing standards when buying antibiotics. If you are looking for factory prices read this: п»їkisawyer.us.com. Good info.

  27. п»їActually I found a useful report about generic pills from India. It covers WHO-GMP protocols when buying antibiotics. If you are looking for factory prices visit this link: п»їkisawyer.us.com. Good info.

  28. Quick question about Canadian Pharmacy Certified Online. I saw a decent site that lists affordable options: professionalinsight.us.com. Any thoughts?.

  29. To save cash on meds I suggest visiting this resource. The site explains prices for generics. Huge savings found here: п»їthis link.

  30. Has anybody tried buying verified meds. I found a decent archive that reviews safe places: canadian pharmacies. What do you think?.

  31. If you want to save big on pills you should try reading this resource about Canadian meds. It shows where to buy cheap. Discounted options at this link: online canadian pharmacy.

  32. For those looking to save on pharmacy costs I suggest visiting this archive about Canadian Pharmacy Certified Online. It shows prices for generics. Discounted options found here: professionalinsight.us.com.

  33. п»їJust now I came across an informative article about cheap Indian generics. The site discusses the manufacturing standards on prescriptions. If you are looking for cheaper alternatives check this out: п»їhttps://kisawyer.us.com/# indianpharmacy com. Worth a read.

  34. Has anybody tried buying verified meds. I saw a verified post that reviews best Canadian pharmacies: safe canadian pharmacy. Any thoughts?.

  35. To be honest I found a useful page concerning safe Canadian shipping. It details how to save money for generic meds. If you are looking for cheaper alternatives check this out: professionalinsight.us.com. Cheers.

  36. To save cash on meds I suggest visiting this archive. It reveals trusted Mexican pharmacies. Best prices found here: п»їhttps://polkcity.us.com/# farmacia mexicana en chicago.

  37. Lately I discovered a helpful guide about safe Canadian shipping. It explains CIPA regulations for generic meds. If you are looking for affordable options visit this link: https://professionalinsight.us.com/# maple leaf pharmacy in canada. Cheers.

  38. To be honest I found an interesting report concerning buying affordable antibiotics. It details how to save money when buying antibiotics. In case you need reliable shipping to USA check this out: online canadian pharmacy review. Worth a read.

  39. For those looking to save on pharmacy costs I suggest checking this resource about Canadian Pharmacy Certified Online. It reveals trusted Canadian pharmacies. Good deals at this link: MUSC Pharm.

  40. п»їLately I discovered a useful guide regarding buying affordable antibiotics. It explains WHO-GMP protocols for ED medication. If you are looking for factory prices visit this link: п»їkisawyer.us.com. It helped me.

  41. To be honest I found an informative resource about generic pills availability. It details CIPA regulations for generic meds. For those interested in Trusted Canadian sources check this out: check here. Cheers.

  42. Does anyone know Canadian Pharmacy Certified Online. I ran into a verified site that compares safe places: resource. Looks legit.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>