0

How do i go about making these multiple scripts work on a single page?

$(document).ready(function() {
       
                  var str = "";
                  $("select option:selected").each(function () {

                        str += $(this).text() + " ";
                      });
         
                  $(".display_text_here").text(str);
                })
                .change();

This one i would like an IE conditional

$(document).ready(function() {

    $(".select")

        .mouseover(function(){
            $(this)
                .data("origWidth", $(this).css("width"))
                .css("width", "auto");
        })

        .change(function(){
            $(this).css("width", $(this).data("origWidth"));
        });

});

Edited by fielding: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by fielding
0

I always use this:
http://www.quirksmode.org/js/detect.html

And then I believe this should work:

$(document).ready(function() {
	var str = "";
    $("select option:selected").each(function () {
		str += $(this).text() + " ";
    });
    $(".display_text_here").text(str);

	if(BrowserDetect.browser == "Explorer") { // optional include version number in criteria: && BrowserDetect.version == "7"
		 $(".select")
        .mouseover(function(){
            $(this)
                .data("origWidth", $(this).css("width"))
                .css("width", "auto");
        })
        .change(function(){
            $(this).css("width", $(this).data("origWidth"));
        });
	}
}).change();
0

I always use this:
http://www.quirksmode.org/js/detect.html

And then I believe this should work:

$(document).ready(function() {
	var str = "";
    $("select option:selected").each(function () {
		str += $(this).text() + " ";
    });
    $(".display_text_here").text(str);

	if(BrowserDetect.browser == "Explorer") { // optional include version number in criteria: && BrowserDetect.version == "7"
		 $(".select")
        .mouseover(function(){
            $(this)
                .data("origWidth", $(this).css("width"))
                .css("width", "auto");
        })
        .change(function(){
            $(this).css("width", $(this).data("origWidth"));
        });
	}
}).change();

Thanks madmital , Much appreciated!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.