取得当前节点下第一个元素的文本内容

取得checkbox前面的文本内容:







有机水果




 

js

function setValue() {
            var salecatIds = "";
            var salecatNames = "";
            $('input:checkbox[name="salecatIds"]:checked').each(function(){
                var catId = $(this).val();
                var catName = $('#gridTreeTrid'+catId).children().first().text();
                salecatIds += catId + ",";
                salecatNames += "," + catName;
            });

            salecatNames = salecatNames.substring(1);
            alert(salecatNames);

        }

 

你可能感兴趣的:(javascript)