0

I found a great code here for creating a drop down menu.

    <select id="mySelect">
   <option value="-">-</option>
   <option value="http://www.google.com">Google</option>
   <option value="http://www.facebook.com">Facebook</option>
</select>

<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
   $("#mySelect").change(function(){
      if ($(this).val()!='') {
         window.location.href=$(this).val();
      }
   });
});
</script>

But would like to pimp it up a bit and change the visuals - size of box & font and background colour to make it fit with the rest of our site visuals. I've tried adding the requirements in a simple tag but it didn't work. I'm very new to script so this one is a bit beyond me. Any advice?

closed as off-topic by Christoffer, Gaurravs, Asad Refai, Mohamed El-Qassas MVP Sep 14 '17 at 7:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions not specific to SharePoint are off-topic here, but can be asked on Stack Overflow." – Christoffer, Gaurravs, Asad Refai, Mohamed El-Qassas MVP
If this question can be reworded to fit the rules in the help center, please edit the question.

1

If this below is the option you want to change the font size in SELECT tag

 <option id="op1">option 1</option>

Place the below code in head element

<script>
 document.getElementById("op1").style.fontSize ="25px";
</script>

OR Else Try This

<div class="card">
<div id="name" class="badge">
<div id="address" class="badge">
</div>
<select id="font-size">
  <option value="12">12</option>
  <option value="14">14</option>
  <option value="18">18</option>
</select>

var id;
$(".badge").click(function(){
id = this.id;
});
$("#font-size").change(function(){
if (id) $("#"+id).css('font-size', $(this).val()+"px");
});
1

You could use jQuery SelectBox/Drop-down Plugins to format drop down menu in select box.

For more detailed information, you could refer to the article below.

https://www.sitepoint.com/13-jquery-selectboxdrop-down-plugins/

  • Using additional plug-ins you overload the work of the web application and tie yourself to the version of the product. – user37251 Sep 13 '17 at 9:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.