Javascript 替换href元素菜单中的SID值数据
我想将菜单中的所有SID=xxxx替换为SID=yyyyJavascript 替换href元素菜单中的SID值数据,javascript,jquery,angularjs,dom,Javascript,Jquery,Angularjs,Dom,我想将菜单中的所有SID=xxxx替换为SID=yyyy <ul class="menu"> <li><a href="http://localhost:11111/controller1/action1?SID=21212121">Menue 1</a></li> <li><a href="http://localhost:11111/controller1/action2?SID=21212121">Me
<ul class="menu">
<li><a href="http://localhost:11111/controller1/action1?SID=21212121">Menue 1</a></li>
<li><a href="http://localhost:11111/controller1/action2?SID=21212121">Menue 2</a></li>
<li><a href="http://localhost:11111/controller1/action3?SID=21212121">Menue 3</a></li>
</ul>
$scope.SID获得了新值。类似于:
var newSID='4545'
$'btn'。单击,函数{
$'a'。每个函数{
var href=$this.attr'href'.replace/SID=[0-9]+/g,'SID='+newSID;
$this.attr'href',href;
};
};
点击我
$http.post(sUrl,sPostData).then(function(controller1Response) {
$scope.result = controller1Response.data.ResultSet.result;
$scope.SID = controller1Response.data.ResultSet.SID;
});