jquery中mulitple的id / class / name [英] id/class/name for mulitple in jquery

查看:72
本文介绍了jquery中mulitple的id / class / name的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个href ..我想使用相同的jquery函数来点击它们中的任何一个...

那么使用什么



id / class / name。

for exp。





I have multiple a href ..i want to use same jquery function to be called when any of them is clicked..
so what to use

id/class/name .
for exp.


<a href="#" name="idvalues" id="getvalu2" class="item">test3</a>

<a href="#" name="idvalues" id="getvalu4" class="item">test4</a>


in jquery i want as 


$().click(function {

});

推荐答案

()。click(function {

});
().click(function { });


您可以按照以下程序起诉name属性:< br $> b $ b

You can sue name property as per following program :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication2.WebForm2" EnableViewState="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
   <script type="text/javascript">


(< span class =code-sdkkeyword> document )。ready( function (){
(document).ready(function () {

这篇关于jquery中mulitple的id / class / name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆