Adding numbers in radio buttons in a bipolar matrix table - troubleshooting | XM Community
Skip to main content

Hi,
I have followed a previous discussion on how to add numbers in radio buttons in a bipolar matrix table. I copied the following JavaScript into my own survey:
jQuery("#"+ this.questionId +" tr.ChoiceRow > td.c4 > label").html("1");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td.c5 > label").html("2");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td.c6 > label").html("3");
BUT, all my radio buttons only show a "1". Can somebody please advise?

Hi LduP ,
If you want to add the labels for the first row then you can use the below code, this will add the label number for the radio button in first row.
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(1) > label").html("1");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(2) > label").html("2");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(3) > label").html("3");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(4) > label").html("4");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(5) > label").html("5");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(6) > label").html("6");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(7) > label").html("7");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(8) > label").html("8");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(9) > label").html("9");
jQuery("#"+ this.questionId +" tr.ChoiceRow > td:eq(10) > label").html("10");
If you want label numbering for all the radio buttons then you can use the below code,
jQuery("#"+ this.questionId +" tr.ChoiceRow").each(function(){
jQuery(this).find("td:eq(1) > label").html("1");
jQuery(this).find("td:eq(2) > label").html("2");
jQuery(this).find("td:eq(3) > label").html("3");
jQuery(this).find("td:eq(4) > label").html("4");
jQuery(this).find("td:eq(5) > label").html("5");
jQuery(this).find("td:eq(6) > label").html("6");
jQuery(this).find("td:eq(7) > label").html("7");
jQuery(this).find("td:eq(8) > label").html("8");
jQuery(this).find("td:eq(9) > label").html("9");
jQuery(this).find("td:eq(10) > label").html("10");

});



@ SurajK
Thank you so much! It works perfectly! You are really a Guru!!


Leave a Reply