Reputation: 7777
my code
function hide()
{
var lblclear= document.getElementById("<%=Label1.ClientID%>");
if(lblclear!= null) {
lblclear.value="";
lblclear.innerText="";
lblclear.outerText="";
}
}
on button click i am calling this function
the above function works fine in IE it is clearing my label text value in firefox browser it is not clearing my label text value
can any one help me out thank you
Upvotes: 0
Views: 949
Reputation: 8648
innerText
will only work in IE, for other browser you should use innerHTML
function hide()
{
var lblclear= document.getElementById("<%=Label1.ClientID%>");
if(lblclear!= null) {
lblclear.value="";
if (document.all) { // check if IE
lblclear.innerText="";
lblclear.outerText="";
}
else{ // other browsers
lblclear.innerHTML="";
lblclear.outerHTML=""; // updated. thanks @cdmckay
}
}
}
please check working example
Upvotes: 1
Reputation: 41848
Your problem is that innerText and outerText is not supported on Firefox.
In order to hide this you can remove it (as that looks like what you are doing) or, preferably, using css, either the element.style properties or set className, but you can set the visibility or display to a value that does what you want.
Upvotes: 3
Reputation: 8075
Add a call to Alert in your function to see if your function is even getting called.
Upvotes: 0