Questions tagged [attr]

This tag should be used for attribute related issues.

An attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such.

1197 questions
-2
votes
1 answer

If else statement JavaScript

I am learning JavaScript and I need help as I don't know how to use boolean for your if else statement for an attribute. Please help me, thanks. I am trying to make my search bar hide and show on click using jQuery. $(function() { function…
M Saud
  • 1
  • 1
-2
votes
2 answers

How to get all decendant li of ul even under another ul

how can i get "all" attr("class") of li under ul#div and return it as array with out repeating same value of class?
mon-sun
  • 95
  • 9
-2
votes
2 answers

Toggle attr of svg with jQuery

I understand that I cannot use addClass or removeClass with SVG and that I must use attr. But how can I toggle an attr of an SVG using jQuery. See my fiddle. I am trying to toggle the rotation of the arrow on click (see the commented out portion…
JordanBarber
  • 1,729
  • 3
  • 29
  • 54
-2
votes
1 answer

Is it possible to set ID and Class of an element using jQuery method attr()?

$("selector").attr("id","idname"); Is it possible to use above for setting ID or Class of an element.
Raghul Rajendran
  • 456
  • 2
  • 6
  • 23
-2
votes
2 answers

jquery "on" properties for div get "attr" not working?

jquery on click get attr
click me