从值中删除#(jQuery) [英] Remove # from value (jQuery)
本文介绍了从值中删除#(jQuery)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var current = $(this).attr('href');
alert(current);
用'#'显示值,例如'#target'而不是'target',我要在代码中修改什么?
shows the value with '#' eg '#target' instead of just 'target', what do I modify in the code?
谢谢
推荐答案
var current = $(this).attr('href').slice(1);
alert(current);
这篇关于从值中删除#(jQuery)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文