IE7 and IE8 Select Use jquery clone incompatibility processing

Source: Internet
Author: User

This solution is based on http://blog.csdn.net/zzx3q/article/details/8017794

Under IE7 and IE8, using jquery clone to copy a select, the copied select is a copy of the main body's select initialization and cannot replicate the current ontology select selection.

Solution:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "UTF-8"><title>Insert Title here</title><Scripttype= "Text/javascript"src= "./lib/jquery-1.7.2.min.js"></Script><Scripttype= "Text/javascript">    //IE7 and IE8 compatible    functionTestselect () {varTR= $("#table"). Find ("tr:eq (0)"); varTest= $("<tr></tr>");        Test.append (tr.html ()); $("#table"). append (test); }        //IE8 above compatible    functionTestsecond () {varTR= $("#table"). Find ("tr:eq (0)"); $("#table"). Append (Tr.get (0). outerHTML); }        functionTeschange (obj) {$ (obj). Find ("Option:eq (3)"). attr ("selected",'selected'); }        functionTestclone () {varTR= $("#table"). Find ("tr:eq (0)"); $("#table"). Append (Tr.clone ()); }</Script></Head><Body>    <TableID= "Table">        <tbody>            <TR>            <TD>                            <Table>                    <tbody>                        <TR>                            <TD><Selectonchange= "Teschange (this)">                        <optionvalue= "Volvo">Volvo</option>                        <optionvalue= "Saab"selected= ' selected '>Saab</option>                        <optionvalue= "Opel">Opel</option>                        <optionvalue= "Audi">Audi</option>                </Select></TD>                        </TR>                    </tbody>                </Table>                </TD>            </TR>        </tbody>    </Table>    <inputtype= "button"value= "Test Copy"onclick= "Testselect ()"></input>    <inputtype= "button"value= "Test second Replication"onclick= "Testsecond ()"></input>    <inputtype= "button"value= "jquery clone"onclick= "Testclone ()"></input></Body></HTML>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.