I have an id "content", it contains many images Google Drive URLs. So, I have match all URLs and replace them with clickable link.
Here is my code
$(document).ready(function(){
function replace_content(content)
{
var exp_match = /(\b(https?|):\/\/drive\.google\.com\/[-A-Z0-9+&@#\/%?=~|!:,.;]*[-A-Z0-9+&@#\/%=~|])/ig;;
var element_content=content.replace(exp_match, "<a href='$1'>$1</a>");
return element_content;
}
var content = $('#content').html();
$('#content').html(replace_content(content));
Here is my results
www.nhadatcantho.net
Now I want to replace all of Urls into image automatic and can display as images I uploaded directly.
www.nhadatcantho.net
I hope my question will be answered. Auto display all images hosted in Google Drive in the id "content"
Here is my code
$(document).ready(function(){
function replace_content(content)
{
var exp_match = /(\b(https?|):\/\/drive\.google\.com\/[-A-Z0-9+&@#\/%?=~|!:,.;]*[-A-Z0-9+&@#\/%=~|])/ig;;
var element_content=content.replace(exp_match, "<a href='$1'>$1</a>");
return element_content;
}
var content = $('#content').html();
$('#content').html(replace_content(content));
Here is my results
Rao Vặt Miễn Phí Cần Thơ
RaoVatCanTho.Com đăng tin rao vặt miễn phí, tuyển dụng việc làm đăng tin nhà đất miễn phí. Trang mua bán rao vặt Cần Thơ không cần đăng ký tài khoản
Now I want to replace all of Urls into image automatic and can display as images I uploaded directly.
Rao Vặt Miễn Phí Cần Thơ
RaoVatCanTho.Com đăng tin rao vặt miễn phí, tuyển dụng việc làm đăng tin nhà đất miễn phí. Trang mua bán rao vặt Cần Thơ không cần đăng ký tài khoản
I hope my question will be answered. Auto display all images hosted in Google Drive in the id "content"