I have the following div structure, but this structure is changing
<div class="rt-container">
<div class="rt-block">
<div id="rt-mainbody">
<div id="responseMessage">Welcome bogyoro. Now you are loged in.</div>
<div id="responseErrorMessage">5</div>
</div>
</div>
</div>
I'm using the following code to get the responseMessage content:
var div = logReg.query("<div>").html(msg);
var message = div.children('#responseMessage').html();
var isValid = div.children('#responseErrorMessage').html();
if(isValid == null)
{
message = div.find('#responseMessage').html();
isValid = div.find('#responseErrorMessage').html();
}
But the isValid is null.
Update:
var logReg = {};
logReg.query = jQuery.noConflict(true);
var isValid = div.children('#responseErrorMessage').html();
if (isValid == null) { }
Will always result in false. If the element exists, that is.
If an element is empty, the return will be an empty string. Try out if (isValid == "") { } instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With