Plug-in Linkselect from Giva Labs
in Using jQuery Plugins
•
9 years ago
I have a select list with some options opening URLs in a new window and I use the below jQuery:
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
The script for linking the options of the select list is the following:
- <script type="text/javascript">
- $(document).ready(function() {
- $('.openSelect').change(function(){
- var selectedValue=$(this).val();
- if (selectedValue.match(/http/)) {
- var open = window.open($(this).val(),'_blank');
- if (open == null || typeof(open)=='undefined'){
- alert("Please turn off pop-up blocker and reload this page to visit: " + selectedValue);
- }
- }
- });
- });
- </script>
I’m trying to implement the plug-in Linkselect from Giva Labs to fix the width problem with IE6, 7 and 8 (dropdown width not adjusting to content) but it’s not working.
http://www.givainc.com/labs/linkselect_jquery_plugin.htm#options
My select tag is the following
- <select class="openSelect" style="width:px; color:#0066ff;">
so I added the the following in the head:
- <script type="text/javascript" src="js/jquery.linkselect.min.js"></script>
- <script type="text/javascript" src="js/jquery.bgiframe.js"></script>
- <link type="text/css" href="css/jquery.linkselect.css" rel="stylesheet" media="all" />
and added $('.select.openSelect').openSelect(); to my script as below:
- <script type="text/javascript">
- $(document).ready(function() {
- $('.select.openSelect').openSelect();
- $('.openSelect').change(function(){
- var selectedValue=$(this).val();
- if (selectedValue.match(/http/)) {
- var open = window.open($(this).val(),'_blank');
- if (open == null || typeof(open)=='undefined'){
- alert("Please turn off pop-up blocker and reload this page to visit: " + selectedValue);
- }
- }
- });
- });
- </script>
Thanks
1