【问题标题】:Failed to append image along with text in asp.net无法在 asp.net 中附加图像和文本
【发布时间】:2013-04-28 03:28:45
【问题描述】:

这是我的代码,我想在文本中附加图像

代码:

 $(".ChatSend").click(function () {
            strChatText = $('.ChatText', $(this).parent()).val();
            var recievertext=  $('.ausername').html();
            if (strChatText != '') {
                var strGroupName = $(this).parent().attr('groupname');
                if (typeof strGroupName !== 'undefined' && strGroupName !== false)
                    chat.server.send($("#hdnUserName").val() + ' : ' + strChatText, $(this).parent().attr('groupname'));
//this code is not working
                    **var userphoto="<img  height=\"18px\" width=\"18px\" src=\"userimages/5.jpg\" />";
                $('.ChatText', $(this).parent()).find('ul').append(userphoto + strChatText);**
//end of this code is not working
                $('.ChatText', $(this).parent()).val('');
            }
            return false;
        });

【问题讨论】:

    标签: javascript jquery asp.net jquery-ui signalr


    【解决方案1】:

    将内容放在li 中怎么样?因为您要附加到ul

    $('.ChatText', $(this).parent()).find('ul').append('<li>'+userphoto + strChatText+'</li>');
    

    【讨论】:

      猜你喜欢
      • 2012-06-20
      • 2012-01-03
      • 1970-01-01
      • 2019-02-08
      • 2012-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多