Anushya Charles
Anushya Charles

Reputation: 63

document.getElementById("id").valid not working in higher versions of firefox

I am working on a firefox plugin that uses firebreath framework. The plugin checks whether the firebreath dll is registered using the following code.

if(document.getElementByID("dllID").valid)
{
alert("Dll registered");
}
else
{
alert("Condition failed");
}

The code works fine for firefox upto version 28.

For higher versions the condition always fails. Can anyone help me in this??

Upvotes: 2

Views: 74

Answers (2)

Noitidart
Noitidart

Reputation: 37328

Try .hasAttribute, .getAttribute, and .setAttribute

document.getElementByID("dllID").hasAttribute('valid')

Without these, is usually for XBL properties but things like id work too.

Upvotes: 0

Connor S
Connor S

Reputation: 152

I've never heard of the valid attribute. What are you trying to accomplish exactly? If it is for form validation, you probably need to deal with validation objects https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Data_form_validation#The_HTML5_constraint_validation_API

if (document.getElementbyID("dllID").validity.valid){
    ...
} else {
    ....
}

Whats more, is this api seems to be present in FF29+ so it probably deprecated the plain valid attribute you are used to

Upvotes: 1

Related Questions