js, jquery, css and error collection properties

*) Note the use jquery to set css syntax

css ( "propertyname", "value "); # always a single comma 
css ({ "propertyname": " value", "propertyname": "value", ...}); # plurality always braces, middle colon

  

 *) Jquery and js approach is different

  Such as getting and setting the textarea content reference links: https://blog.csdn.net/glgom/article/details/88142605

<Script type = "text / JavaScript"> 
    function Change () { 
        / ** set JS * / 
        var = document.getElementById Test ( "Test"); 
        test.innerHTML = "Hello, Earth!"; // Method 1 
        test.value = "hello, China!"; // method 2 
        test.innerText = "green Earth!"; // method 3 
 
        / ** JQ set * / 
        $ ( '# the Test ") HTML (" hello. , I'm so, Hello, everyone "); // method 1! 
        $ (" # the Test ") Val (." happy days "); // method 2 
        $ (" # the Test HTML studious ")") text (. " ; // method. 3 
    } 
</ Script>

  I made a mistake even have to think that this language is only two ways to obtain dom elements are different:

virtual_click function () { 
    // $ ( '. jfk-the Button-img'). the Click () 
    // $ ( '# Source'). the Click () 
    console.log ( 'the event has run') 
    $ ( '# Source ') .css (' background ', ' # 5d885d '); // this useful # I initially because this method will be able to get set up and then call the css style that only js and jq In addition to selecting methods differ only. And there is no thought of before school Atribute () method and .style.color = '' In this way, while learning these, they also failed to recognize js and jq are different, hey 
    var tem = $ ( '# source ' ) # even thought of this, that is a direct $ ( '') value =. '' properties of the object will be wrong this ridiculous idea 
    tem.value = ''; // this does not work, I do not know why, now know, of course, useless a 
    tem.val ( ''); 
}

  

 

Guess you like

Origin www.cnblogs.com/Gaoqiking/p/11404039.html