0

I am stuck in an easy but so difficult task. I am having a string that contains a single '@' sign. The first part of string is a path of type : GroupPictures/G261-MyGroup/GU53-user2.png Second part is a name Like say USER.

Now i need to seperate these two parts using javascript and display them as html so i did something like this :

var parts=this.toString().split("@");
            var myusername=parts[1];
            var filenamee=parts[0].trim();
            alert(filenamee);
            if ($.cometChat.loginUserName == this) { //login user
                sb[sb.length] = "<span class='one_test'><img style='border-radius:100%;float:left;width:35px;' src="+filenamee+" /><div class='chat_account_name'>" + myusername + "</div><div class='status_offline'></div></span><br>";
            } 

But the problem is image is not being displayed though the name is displayed right.I want to know am i missing some quotes to close or what is problem with it ?

Problem is with this line only :

"<span class='one_test'><img style='border-radius:100%;float:left;width:35px;' src="+filenamee+" /><div class='chat_account_name'>" + myusername + "</div><div class='status_offline'></div></span><br>"

1 Answer 1

3

Use

              src='"+filenamee+"'

not

           src="+filenamee+"  

so it will be like

         src='asdasd'

not

       src=asdasd
Sign up to request clarification or add additional context in comments.

6 Comments

HTML5 makes it acceptable to not using quotation marks when setting attributes, so I'm not sure if that weighs in here or not, but I had the same guess as you.
sb[sb.length] = "<span class='one_test'><img style='border-radius:100%;float:left;width:35px;' src='"+filenamee+"' /><div class='chat_account_name'>" + myusername + "</div><div class='status_offline'></div></span><br>"; ALSO NOT SERVE THE PURPOSE
But not everyone has html5 :(
@huseyintugrulbuyukisik Its still not been visible
@user3522121 maybe 100% border radius is not acceptable?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.