My jQuery code is mentioned below.
$('.meraCheck').click(function () {
var text1 = "";
$('.meraCheck:checked').each(function () {
text1 += $(this).parent().text() + ',';
});
text1 = text1.substring(0, text1.length - 1);
$('#selectedConsiderationsText').val(text1);
var pane = $('#selectedConsiderationsText');
var trimmed_text= pane.val($.trim(pane.val()).replace(/\s*[\r\n]+\s*/g, '\n').replace(/(<[^\/][^>]*>)\s*/g, '$1').replace(/\s*(<\/[^>]+>)/g, '$1'));
});
$('.meraRadio').click(function () {
var text = "";
$('.meraRadio:checked').each(function () {
text += $(this).parent().text() + ',';
});
text = text.substring(0, text.length - 1);
$('#selectedConsiderationsText').val(text);
var pane = $('#selectedConsiderationsText');
pane.val($.trim(pane.val()).replace(/\s*[\r\n]+\s*/g, '\n').replace(/(<[^\/][^>]*>)\s*/g, '$1').replace(/\s*(<\/[^>]+>)/g, '$1'));
});
Currently in Text area it reflects text as mentioned below:
- If I select Checkbox ( as class 'meraCheck'will get clicked ) then in textara it reflects value of selected checkbox only.
- If I select Checkbox ( as class 'meraRadio'will get clicked ) then in textara it reflects value of selected radiobuttons only.
What I want is that I want to merge value both of selected checbox and radio buttons both (at the sametime) in that textarea.
Can please anyone assist me how it will be done?
To merge value of Selected Radio button and checboxes in a Textarea.
Aucun commentaire:
Enregistrer un commentaire