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"));
        });

});

Recommended Answers

All 2 Replies

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();

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.