Home  >  Article  >  Web Front-end  >  jQuery cascade operation binding event instance_jquery

jQuery cascade operation binding event instance_jquery

WBOY
WBOYOriginal
2016-05-16 16:38:061415browse

Cascading operation binding events is a very practical technique in jQuery. This article implements this function in the form of examples. Share it with everyone for your reference. The specific method is as follows:

The example described in this article mainly implements jQuery to operate a list, select a school according to the category, click on the school to display the department, click on the department to display the major, and then link to the major application page.

The specific function codes are as follows:

$("li.university").click(function(){
  var id = $(this).attr("rel");
  $.get("data.aspx?type=u&id="+id ,
  function(html){$("#universityselect").html(html);});
});
$("li.universityselect").click(function(){
  var id = $(this).attr("rel");
  $.get("data.aspx?type=s&id="+id ,
  function(html){$("#coursetype").html(html);});
});
$("li.course").click(function(){
  //var id = $(this).attr("rel");
  alert("dd");
  //$.get("data.aspx?type=p&id="+id ,
  //function(html){$("#sourseselect").html(html);});
});

I believe that what is described in this article has certain reference value for everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn