Insert Label for Radio Button Dynamically

By Sam Deering

Simple jQuery code snippet to insert a label for a radio button dynamically. You can create a label element and insert it before the radio button like so:

var labelText = $('#radioBtnId').attr('name');

No Reader comments


Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.