Hi,
According to your post, my understanding is that the search scope return to the default value while searching an item.
I have made a code demo to keep the search scope value while searching an item, it works like a charm, you can have a look at it.
<script src="http://ift.tt/KxYiSw; type="text/javascript"></script>
<script type="text/javascript">
$(function(){
var searchScope=getUrlParam("s");
//alert(searchScope);
if(searchScope!=null){
//alert(1);
$("select[title='Search Scope'] option").each(function () {
if ($(this).text() == searchScope) {
//$(this).text(optionText);
$(this).attr("selected","selected");
}
});
}
});
function getUrlParam(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r!=null) return unescape(r[2]); return null;
}
</script>
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support
No comments:
Post a Comment