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
-3
votes
3 answers

How to add one new attribute ' ref="gallery" ' to img tag with jquery?

One Article includes many images, add one new attribute ( ref="gallery" ) to img tag with jquery when user view article, How do? Example: Change to
Clinton
  • 33
  • 2
  • 5
-3
votes
3 answers

Undefined when trying to use addClass on $(this) anchor tag

function showImage(imageSrc) { $('a.slideTabLinkBlock').removeClass('active'); alert($(this).attr('class')); $(this).addClass('active'); }
-3
votes
1 answer

Jquery .removeClass before append fails on

see jsfiddle https://jsfiddle.net/codenoob/3v3mfndg/1/ I have a table that is hidden. I set that as a template to clone more row. however I want to remove the hidden class when appending new rows but cant. It can removeClass on all the element…
codenoob
  • 513
  • 1
  • 6
  • 24
-3
votes
2 answers

Random .attr('src', image) for an image(logo), why Uncaught TypeError: $ is not a function?

I've realized a random function to set different logo every time you refresh page: https://jsfiddle.net/py3ttdc2/ But the browser console show this error: (index):268 Uncaught TypeError: $ is not a function logoRandom @ (index):268 …
-3
votes
1 answer

AttributeError: '' object has no attribute 'exit'

Throws error: Line 2: AttributeError: '' object has no attribute 'exit' when from sys import exit is run. How do I fix this? Problem part of code: from sys import exit
Jenny Wen
  • 1
  • 1
  • 4
-3
votes
4 answers

jQuery find style attr of ID

How can I find the style attribute of a particular ID element? E.g desc = "#thisID"; desc_style = desc.attr('style'); console.log(desc_style); Edit for clarification, above is an example. Desc variable holds string #thisID. How do I find the style…
Francesca
  • 22,178
  • 26
  • 80
  • 145
-3
votes
3 answers

Jquery grab attr from automatically generated div

I create a search engine and I have a problem.
Smiley face

'+this.name+'

Danny
  • 11
  • 1
  • 4
-4
votes
1 answer

var = $('.div').attr('title').split('')[number]

I am trying to set var for my slideshow using a class .selected, but it doesn't work. I am assuming that I have a problem with syntax, but funny enough, I have spent about 2 hours trying to find the correct way of doing it, and didn't find anything…
Tony
  • 61
  • 6
-4
votes
2 answers

Loop for custom attr

I'm looking for a loop that will count like that 1 , 0.8 , 0.6, 0.4 , 0.2 , 0.2 , 0.4 , 0.6 , 0.8 , 1 and append to custom attr "data-depth" with li element i got so far something like that and I cant move on for (var i = 0; i < 5; i++) { …
Szymon
  • 1,254
  • 19
  • 34
-4
votes
3 answers

How to do .attr or similar using javascript without using jquery?

$("#my_iframe").attr("src","www.examples.com?x=asd&y=qwe"); This is done using jquery while I have to perform this operation without jquery. How to implement this with javascript?
Subham93
  • 625
  • 8
  • 14
-4
votes
2 answers

attr function in jquery

its my code for editing image src with output from json request everything works before return but when i'm write code to return output its getting error, dont changing image src. $(function(){ $( ".plimg" ).attr( "src", function( index ){ track =…
1 2 3
79
80