Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次の文字列があります。
var str = "\\Desk-7\e\cars\car1.jpg";
私は取得したいcar1.jpg。jqueryまたはjavascriptを使用してそれを取得するにはどうすればよいですか
car1.jpg
によって行うことができます
function basename(path) { return path.replace(/\\/g,'/').replace( /.*\//, '' ); }
str.split('\\')を使用してから最後のインデックスを使用します
.split('\\')