Reputation: 43
I want to split
the filename and get the last path of the string in javascript.
For example the path is D://Smita//GMAP//Images//images.jpg
, but according to my requirement it should be Images/images.jpg
How to acheive this using javascript?
Upvotes: 0
Views: 185
Reputation: 70169
var path = 'D://Smita//GMAP//Images//images.jpg'.split('//').slice(-2).join('/');
//path is "Images/images.jpg"
For a Google Maps info window you should be able to throw it as the src
of an img
element:
content: '<img src="'+path+'">'
See related How to add an image to InfoWindow of marker in google maps v3?
Upvotes: 2