Re: Compare paragraph text
what is the text in? Is it inside a div? Or some other object? You can use, as you suggested, get element by ID but it has to be in some element, with a unique id.
EX:
Code:
<html>
<head>
<javascript type="text/javascript">
function checkMe(){
var p1 = document.getElementByID("P1").innerHtml
var p2= document.getElementByID("P2").innerHtml
alert(p1 + " " + p2)
}
</javascript>
</head>
<body>
<div id="p1" >Hello world</div>
<div id="p2" >Hello world</div>
<button onclick="checkMe()"/>
</body>
</html>
This is just freehand, so it might need some tweaking. If this doesnt work, post what you have.
jason
Re: Compare paragraph text
I have something like this:
Code:
<div id="footer">
<p id="copyright">All rights reserved © 2013 Design4U</p>
</div>
Of course, footer div is inside main div. So, how I get text from this paragraph?