Questions tagged [setattribute]
434 questions
-1
votes
1 answer
How does one make createElement('IMG') clickable?
My goal is to make the bottom Queen, a created element, clickable the same as the top Queen. How does one accomplish that?


JimM
- 111
- 1
- 11
-1
votes
3 answers
How to set attributes of a div tag dynamically?
I am having a div and using javascript to set attribute for it with the below code
Javascript
var m = document.getElementById('d1');
m.setAttribute("height","50%");
but it throws an error as setAttribute() property cannot be set to the null…

Swetha Puthuru
- 15
- 1
- 2
- 5
-1
votes
1 answer
How do I add a js variable to the url when using the href setAttribute function?
I'm using jquery to grab a variable in the url (http://website.com?Name=Brian) and setting a javascript variable as such:
var name = getQueryVariable('Name');
Now I'm trying to dynamically update an href property in Unbounce (unbounce.com) as…

brianjambor
- 1
- 1
-1
votes
2 answers
How to: setAttribute send 5% + var x %?
How can i make elem.setAttribute("style","border-top-right-radius: 5% 5%;");
To send this elem.setAttribute("style","border-top-right-radius: 5% x%;");
Sett the last 5% to the value of var x.
var element1 = document.getElementById("content"),
style…

KevinHaugen
- 79
- 1
- 1
- 9
-1
votes
1 answer
request.getattribute are null and some are having data
Is there any limit in number of set attributes you can use in java ?
Because i am trying to set attributes in java and request them in JSP page.
when i see the console i can see the values are being set(by using system.out.println(obj)) but at JSP…

vickyreddi
- 16
- 5
-1
votes
1 answer
javascript type error: Cannot call method 'setAttribute' of null
I'm trying to change the value of a button from 'send' to 'sending' when it's clicked.
I get the error above called on this line:
document.getElementById("submin_btn").setAttribute("value","Sending...");
What's the problem?

DBWeinstein
- 8,605
- 31
- 73
- 118
-2
votes
2 answers
setAttribute is not a function within Array
I'm trying to assign an attribute to every item in an array conditionally based on a radio value. I've gotten all the way up to actually setting the required attribute but for some reason, I can only set it on items individually, not to every…

Patrick
- 1
- 2
-2
votes
2 answers
setAttribute, onclick, eventListener won't work
So i have this code in javascript that replaces the text from the html, depending on the language you click on ( romanian or english, default is romanian). I tried all of the 3 ways i know for the click action, but none of them work. Can you please…

Andrei Manolache
- 766
- 1
- 8
- 17
-2
votes
2 answers
Change attribute of all UL and LI tags on a single click
I need to change the attribute 'aria-expanded' from 'true' to 'false' of all the ULs and all the LIs on a single click.
I'm having a hard time to figure out how to do that.
Here's the sample html
List 1
-
Sunny
- 902
- 3
- 18
- 41
-2
votes
1 answer
Add img attributes using JavaScript
I know that this question has been asked several times, but I have problems when I try to appendChild the img to a div.
Here is the code:
var picture = document.createElement("img");
picture.id= "xmark";
picture.src=…

s.dragos
- 582
- 2
- 8
- 24
-2
votes
2 answers
Only the last setAttribute is executed
I am trying to set mutliple attributes to a form. I want the form to be centered and the background to be orange. But only the last attribute is executed. So in the code below the background color would be orange but the form would not be…

zach
- 27
- 7
-3
votes
2 answers
What is setAttribute arguments in JavaScript?
can someone please explain to me what is the setAttribute arguments here? I know only that .png is the extension of the image that I will include later in my code.
function setImg(dieImg)
{
var value = Math.floor( 1 + Math.random()*6);
…

Renad Hamad
- 11
- 2
-3
votes
2 answers
setAttribute with a loop
I am trying to set a src attribute to several images with a loop. I have 8 images and I would like to insert these 8 images into my html. I'am using a for of loop on a array which comes from a JSON files. My JSON seems to be ok, because I can…

Luckyluchie
- 13
- 1
- 5
-5
votes
1 answer
Why We setAttribute ? What is done by setAttribute() function?
Why We setAttribute ? What is done by setAttribute() function?

RABBIL HASAN
- 1
- 2