Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai...
Iam developing a chat application..for that i need to display name in one td of table tr and image in another td..

my code is like this in design..

XML
<div id="chatList">
                   <table>
                   <tr>
                   <td id="showUsernames">
                   </td>
                   <td id="forimage">
                   </td>
                   </tr>
                   </table>
                 
                   </div>



so...in showUsernames id i have to get name and in forimage id i have to display image...i wanted to do this in jquery..please help me..
Posted

jquery

$('#showUsernames').text()
$('#forimage').text()

the biggest question is that you must ensure the element id is unique .
 
Share this answer
 
v2
Comments
aswinisolleti 24-Jul-13 4:05am    
for (var i = 0; i < class1.length; ++i) {
if (class1[i].username != _chatUsername) {

$('#showUsernames').text(class1[i].username)
$('#forimage').text("<img id='theImg' src='Images/offline.jpg'/>")

}
}

iam doing like this in my jquery ...it's not working..
for (var i = 0; i < class1.length; ++i) {

//debug
alert(class1[i].username);
alert(_chatUsername);

if (class1[i].username != _chatUsername) {
$('#showUsernames').text(class1[i].username)
$('#forimage').text("<img id="theImg" src="Images/offline.jpg" />")
}
}

You must find the problem where it appears.

If you still hava any question or need any help,send message to me .
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900