The
Find A-element method is very right, you can pass the ID or class, but if neither of the two conditions, there is no way? NO, through the URL is also possible, here is a good example, you can feel the
Give an example of a previous project: When you add a student, there is no class data. Need to automatically jump to the class display page. Questions: Students, classes and other data is placed in the IFRAME inside the JSP. The student-managed button is on the Main.html menu bar. Solutions: Class Management <a> label for parent form by ID, and click code as follows: $ (window.parent.document). Find ("# Folder_12 "). Click (); later menu bar changed to dynamic, menu ID is also dynamic. Want to get <a> through the URL, and click. Code as follows: <a id= "folder_14" onclick= "removetopmenucss (); Switchfolder (this.id); Changecontent (' Classmanager/classlist.do ', this); "onfocus=" This.blur () "href=" javascript:void (0); "target=" MainFrame "> class Management </a> To obtain is the OnClick method of changecontent (' url parameters ') directly look at the code: Code as follows://console.info ( window.parent.document). Find ("a")); $ (window.parent.document). Find ("#OutFolder a"). each (function index, Domele) { //var s = $ (Domele). attr ("onclick") + ""; //var start = S.indexof (' classmanager/classlist.do '); nbsp var str = domele.attributes.onclick.value;//Use JS to get onclick property value, search url var start = Str.indexof (' ClassmanaGer/classlist.do '); if (start>0) { $ (Domele). Click (); } }); Summary: I've been using jquery to find ways , get the OnClick property, with indexof total error, plus "" space into a string on the line