Remove path from output js

4150 views javascript
6

This is what i have. the out put i get is C./FAKE PATH/(value). I just want it to show the value not the C./FAKE PATH/.

$('#inputid').change(function(){
  var value =$(this).val();
alert(value);
})

answered question

1 Answer

1

You can use split('/').pop() to get anything after the last /.

E.G:

$('#inputid').change(function(){
    var value = $(this).val().split('/').pop();
    alert(value);
})

posted this

Have an answer?

JD

Please login first before posting an answer.

Ads

Categories