I have a JSP page which loads a static HTML page using iFrame. Now i am trying to change the alignment of one of the DIV (which is there in static HTML page) using the jQuery dynamically. But its not working.
var divEnbref = document.getElementById("enbref");
if(divEnbref!=''){
$('#enbref').css("text-align" , "left");
}
DIV
<div id="enbref">Some Content</div>
Can someone help me.
use .innerHTML to get the content of your div
var divEnbref = document.getElementById("enbref").innerHTML;
then use condition statement
if(divEnbref!=''){
$('#enbref').css("text-align" , "left");
}
As you are selecting element inside iframe
you need to select the iframe first.
document.getElementById('myframe1').contentWindow.document.getElementById('enbref')
try this..
Try this :
var divEnbref = document.getElementById('enbref');
document.getElementById('enbref').style.textAlign = "right";
I've tried this in fiddle: https://jsfiddle.net/mgs4y3px/
May this will help you!
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
i'm rendering divs within a loopeach div has a text (could be long- which means overflow: hidden is needed
I've got a div with the ID testimonials that has a height of autoIn the div are a number of section's that vary in height