Problems encountered in Web front-end development process and their solutions (i.)

Source: Internet
Author: User
Tags getscript

1. CSS style precedence issues

1 <style>2 3 . ClassName input (can be swapped for other elements){4 5 type:Val!important;6}7 8 </style>9 Ten <body> One  A <div class= "ClassName" > -  - <input type= "text" value= "" > the  - </div> -  - </body>
View Code

2. JS automatically generated HTML, and do not need to generate the HTML statement repeatedly, the processing scheme is as follows:

1 $ ("element/id/classname"). Remove (). Ready (function() {23     ///  Regenerate code JS45 });
View Code

3. JS is moved to the head of the nested HTML to run, the code is as follows:

1 <Head>2 3     <DivID= ' script 'style= "Display:none;">4 5         <Script>6 7         //script Functions8 9         </Script>Ten  One     </Div> A  -   </Head> -  the   <Body> -  -     <Script> -  + window.onload=function(){ -  +         varGetScript=$("#script"). html (); A  at         $("Head"). HTML ("<div id= ' script ' sty le= ' display:none; ' >"+GetScript+"</div>"); -  -         } -  -     </Script> -  in </Body>    
View Code

If there is a better way to achieve, you can learn from each other! Today is a beautiful day! Come on!

Problems encountered in Web front-end development process and their solutions (i.)

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.