js (jQuery) value

 It's all commonplace, nothing new, it's something that I don't know how to write to Baidu during the development process. It is said that it is a good habit for programmers to write blogs. It is a way to save notes, and they will not need to go everywhere in Baidu and then come out with some unanswered answers.

          1: Get the value of the input tag according to class and id. 
                  jQuery : $(".className").val(); $("#idName").val();
                  javaScript : document.getElementById("idName").value;
       
           2: Get the value between tags according to class and id Content: such as <span>, <lable>, <div>.
                 jQuery : $("#idName").html(); $(".className").html();
                 javaScript : document.getElementById("idName").innerHTML ;
       
          3: get <select id='selectId'> <option value='selectValue'> Selected value:
                 jQuery : $("#selectId").val();
                 javaScript : document.getElementById("selectId").value;
       
          4: Get<

               javaScript : document.getElementById("imgId").src;
       
          5: The child interface gets the content of the parent interface element:
                 5.1 (content between tags, such as <span> , <lable> , <div> )
                       JavaScript : window.parent.document .getElementById("currentPage").innerHTML ;
                       JQuery : $(window.parent.document).find("#IdName").text();
                 5.2 (get the value of the input tag) 
                       JavaScript : window.parent.document. getElementById("currentPage").value ;
                       JQuery: $(window.parent.document).find("#IdName").val();

 

         6: The child interface controls the parent page jump:

                      window.parent.location.href = “*” ;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325619192&siteId=291194637