I am using the following piece of code

function showContacts(records) {    
        function() {
        var newLi = $j('<li></li>');

            var newLink = $j('<a id="' +this.Id+ '" data-transition="flip">'+'<img class="myListimage" src='+this.pic__c+'></img>' +this.FirstName+ ' '+this.LastName+ '</a>');
        newLink.click(function(e) {

            $j.mobile.changePage('#detailpage', {changeHash: true});
      //  x++;


I am displaying it in

<div data-role="content" >
    <li><a href="#"><img src="pic"/></a></li>
    <div data-role="fieldcontain">
        <label for="fName"><b>First Name:</b></label>
        <output name="fName" id="fName" />
    <div data-role="fieldcontain">
        <label for="lName"><b>Last Name:</b></label>
        <output name="lName" id="lName" />
    <div data-role="fieldcontain">
        <label for="phone"><b>Phone:</b></label>
        <output name="phone" id="phone" />

The image is not being displayed. Please let me know if anyone can figure it out Thanks

  • 1
    What is picture1 here? $j('picture1').val(Contacts.findRecordById([this.id]).Picture__c);
    – SE_User
    Jul 21 '16 at 9:57

do you have any 'picture1' tag or is it a id if latter is the case you should prepend a # to picture1 in the below line:


if still out of luck show the console error if any and how u are rendering the image src with value of the tag.


In Html add id to the element

<img id="img" src="pic"/>

In script set src through jQuery attr method

$( "#img" ).attr( "src", Contacts.findRecordById([this.id]).pic__c);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.