createElement, custom style, turn off webkit Appearance
-
I made a button in Java Script, and I'm trying to figure out how to turn off the -webkit-appearance so Safari IOS won't turn the button into a rounded button. I found borderRadius. I want put it inline, instead of modifying the class in the css file, I just need it in one spot. I looked around but didn't really find anything, most searches produced beginner stuff.
var input_Close = document.createElement("input");
input_Close.id = "_bt_pv_close";
input_Close.type = "button";
input_Close.className = "g-button black";
input_Close.style.width = '112px';
input_Close.style.height = '32px';
input_Close.style.borderRadius = '0';
input_Close.style.fontSize = "1.0em";
input_Close.value = "close";
input_Close.size = "30";
input_Close.onclick = function () { sm_unload_Modal_PhotoViewer(); };
div_Close.appendChild(input_Close); -
I made a button in Java Script, and I'm trying to figure out how to turn off the -webkit-appearance so Safari IOS won't turn the button into a rounded button. I found borderRadius. I want put it inline, instead of modifying the class in the css file, I just need it in one spot. I looked around but didn't really find anything, most searches produced beginner stuff.
var input_Close = document.createElement("input");
input_Close.id = "_bt_pv_close";
input_Close.type = "button";
input_Close.className = "g-button black";
input_Close.style.width = '112px';
input_Close.style.height = '32px';
input_Close.style.borderRadius = '0';
input_Close.style.fontSize = "1.0em";
input_Close.value = "close";
input_Close.size = "30";
input_Close.onclick = function () { sm_unload_Modal_PhotoViewer(); };
div_Close.appendChild(input_Close);Why you are not adding whole style to the object in single line of code!
-
I made a button in Java Script, and I'm trying to figure out how to turn off the -webkit-appearance so Safari IOS won't turn the button into a rounded button. I found borderRadius. I want put it inline, instead of modifying the class in the css file, I just need it in one spot. I looked around but didn't really find anything, most searches produced beginner stuff.
var input_Close = document.createElement("input");
input_Close.id = "_bt_pv_close";
input_Close.type = "button";
input_Close.className = "g-button black";
input_Close.style.width = '112px';
input_Close.style.height = '32px';
input_Close.style.borderRadius = '0';
input_Close.style.fontSize = "1.0em";
input_Close.value = "close";
input_Close.size = "30";
input_Close.onclick = function () { sm_unload_Modal_PhotoViewer(); };
div_Close.appendChild(input_Close);Can you please use following:
var div = document.createElement('div');
div.setAttribute('style', 'width:330px; float:left'); -
Why you are not adding whole style to the object in single line of code!
I was a complete newbie to writing HTML in the DOM, and I sort of used that style as the next step of advancement. I couldn't remember the attribute and could not find it through search. I knew there was a one liner for inline style. I was hoping to keep it the same, but I'll convert to your post example. Thanks for the reminder!