var subsectResName = "Hello, world"; var subscribe_id = $('label:contains(' + subsectResName + ')').attr("for");