如何在jQuery中获取具有特定data-id的特定div

时间:2018-12-19 19:17:08

标签: javascript jquery html

我有3个divs

<div class="content" data-id="Java"><button onclick=" onclick="alert('hi')">Java</button></div>
<div class="content" data-id="Php"><button onclick="alert('hi')">Php</button></div>
<div class="content" data-id="C++"><button onclick="alert('hi')">C++</button></div>

并且我想使用data-id =“ Java”来获取div并在jQuery中更改其内部按钮的onclick

1 个答案:

答案 0 :(得分:3)

cor1 <- data.frame(which(cor(dat) == 1, arr.ind = T))
cor1[cor1$row > cor1$col,]
#   row col
# c   3   1

将选择所需的元素

#!/usr/bin/env python

import pexpect
import struct, fcntl, os, sys, signal
import time

def sigwinch_passthrough (sig, data):
    # Check for buggy platforms (see pexpect.setwinsize()).
    if 'TIOCGWINSZ' in dir(termios):
        TIOCGWINSZ = termios.TIOCGWINSZ
    else:
        TIOCGWINSZ = 1074295912 # assume
    s = struct.pack ("HHHH", 0, 0, 0, 0)
    a = struct.unpack ('HHHH', fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ , s))
    global global_pexpect_instance
    global_pexpect_instance.setwinsize(a[0],a[1])

ssh_newkey = 'Are you sure you want to continue connecting'
p=pexpect.spawn('ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 admin@172.16.16.16')
i=p.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT],1)
if i==0:
    p.sendline('yes')
    i=p.expect([ssh_newkey,'password:',pexpect.EOF])
if i==1:
    p.sendline("admin")
    p.sendline("6")
    p.expect([pexpect.TIMEOUT,r'\b below.\b'])
    p.sendline("2")
elif i==2:
    print "Key or timeout"
    pass
elif i==3: #timeout
    pass
p.sendline("\r")
global global_pexpect_instance
global_pexpect_instance = p
signal.signal(signal.SIGWINCH, sigwinch_passthrough)

try:
    p.interact()
    sys.exit(0)
except:
    sys.exit(1)

会将按钮隐藏在其中