JQuery event click, jQuery event click

Source: Internet
Author: User

JQuery event click, jQuery event click

In asp.net or asp.net mvc, the object click event is one of the most commonly used events. It indicates that the user clicks the mouse button and releases the event.

Today is July November, and learning is a new start. There is no special situation in creating a new controller, NovemberController. cs. All the exercises of this month are executed on this controller.

 

A view Action Jqclick () is created ().

 

Demo:



Conflicts with click events of JQuery

Write your # OK and # close as the following: it should be the effect you want.

$ ("# OK"). click (function (){
$ (". Words"). show ()
$ (". Setting"). hide ()
$ ("# Change"). show ();
$ ("# OK"). hide ()
})

$ ("# Close"). click (function (){

$ (". Words"). show ();

$ (". Setting"). hide ()
$ ("# Change"). show ();
$ ("# OK"). hide ()
});
By the way, you can write two $ (# change). click values together.
 
Question about the jquery click Event

In the Event Callback Function of jQuery, this is the element that triggers the event, so you can use $ (this) to select the button yourself in the callback method.

For example, suppose you have a structure like this.
<Table id = "table"> <tr> <td> 1 </td> <a href = "" class = "button"> </a> </ td> </tr> <td> 2 </td> <a href = "" class = "button"> </a> </td> </tr> <td> 3 </td> <a href = "" class = "button"> </a> </td> </ tr> </table> if you want to delete the corresponding tr when you click a, you can write it like this.
$ (". Button"). click (function () {$ (this). closest ("tr"). remove ();});
Similarly, it is similar to searching for associated elements based on $ (this ).

In addition, the number of rows you mentioned can be processed in this way, also based on the above html
$ (". Button "). click (function () {var rowNumber = $ ("# table tr "). index ($ (this ). closest ("tr");}); in fact, it is the number of parent tr closest to the current button in all tr of the table.


Related Article

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.