Hello everybody I need your help with creating a dropdown list with hyperlinks and javascript in sharepoint.
- I created an .txt file
- I added the javascript to the txt file
- I created an addin (content editor) on the front page
- I added the txt file into my content editor
But I have one problem. If I press the hyperlink it will not forward me to the different pages. (my javascript works perfect when i test it in sharepoint)
So i think i need to involve some asp.net code into this javascript file. But I have no idea how I can do that. Can somebody help me?
Kind regards,
Bruins
This is the code in the txt file.
<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
</head>
<title>
</title>
<body>
<select id="mySelect">
<option value="-">-</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.facebook.com">Facebook</option>
</select>
<script type="text/javascript">
$(document).ready(function() {
$("#mySelect").change(function(){
if ($(this).val()!='') {
window.location.assign($(this).val());
}
});
});
</script>
</body>
</html>
<script type="text/javascript">$(document).ready(function() { $("#mySelect").change(function(){ if ($(this).val()!='') { window.location.assign($(this).val()); } }); }); </script>- Edited by BruinsH 16 hours 5 minutes ago html doesn't work