I wonder how can i remove all string part after "#".
For example if i have example.com/hello#item1
how can i remove all characteres after #
and #
character too?
var string = "example.com/hello#item1".split('#')[0];
simple as that
You can just use split.
var oldString ='somestring#removethis';
var newString = oldString.split('#', 1)[0];
alert(newString);
see: http://jsfiddle.net/DGFuf/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With