I am using RightNow CRM software and part of coding our support portal is that I have to use YUI scripting as opposed to jQuery because of best practices (use only one scripting library). I have included the jQuery script that I want to convert to YUI and my YUI "translation" that I attempted. Any help would go a long way, I was using this website to carry out these translations.
$(function() {
$('input').on('click', function() {
var values = [];
$('input:checked').each(function() {
values.push($(this).parent().text());
});
$('[name="result"]').attr({value: values.join(', ')});
});
});
YUI().use('node', 'io', 'event', 'animation', function (Y) {
Y.all('input[type=checkbox]').delegate('click', function(Y) {
var values = [];
Y.all('input:checked').each(function(Y) {
values.push((this).parent().text());
});
Y.one('result').setAttribute({value: values.join(', ')});
});
});
You can try this... Actually I can't test and thus I'm trying to guess what it should do. And also a few improvements to your "translation".
YUI().use('node', 'io', 'event', 'animation', function (Y) {
Y.all('input[type=checkbox]').on('click', function(event) {
var values = [];
Y.all('input:checked').each(function(checkbox) {
values.push(checkbox.ancestor().getHTML());
});
Y.one('[name=result]').set( "value", values.join(', ') );
});
});