+ Start a Discussion
Chidanand MChidanand M 

src attribute of <img> tag in Apex Class

Hello  All,

I am trying to create a table structure in apex class using html.

htmlBody1 = '<html><img width="200" alt="heloo"><br/>';

In the above piece of code if i try to use src attribute to specify the url, it throws me run time error.

htmlBody1 = '<html><img width="200" alt="heloo" src=" "><br/>'; == > this is throwing me a runtime error


Can anybody tell me what exactly m missing here.
 
Raj VakatiRaj Vakati
I tried this code and its wokring for me from developer console 
 
String htmlBody1 = '<html><img width="200" alt="heloo" src="https://www.gstatic.com/webp/gallery3/1.sm.png"><br/>';
System.debug('htmlBody1'+htmlBody1);