logo-MindMajix
PostjQueryjQuery
n
naveen nani

Posted on 21st June 2024|24 views

0
votes

Jquery Selector Attribute

What is jQuery [attribute=value] Selector?

1 answers
Answers
P
ravi sankar

Posted on 21st June 2024| views

The [attribute = value] selector, selects every element with the particular attribute and value.

Syntax:

$(“[attribute=value]”)

Example:

<!DOCTYPE html>

<html>

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script>

$(document).ready(function(){

  $("[id=choose]").css("background-color", "red");

});

</script>

</head>

<body>

<h1>Welcome</h1>

<p class="intro">My name is Schinchan.</p>

<p>I live in Kasukabe.</p>

<p>My best friend is Masaw.</p>

Who is your favourite:

<ul id="choose">

  <li>Hiroshi</li>

  <li>Actionkamen</li>

  <li>Mitsi</li>

</ul>

</body>

</html>

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number