How to check element existence using its alias attributes with Mootools
Tried as follows. But its not working,
<select alias="school_type" id="15_4_19" name="15_4_19">
<option label="" value="">Select</option>
<option selected="selected" label="High School" value="8">High School</option>
<option label="University" value="9">University</option>
<option label="Elementary Schools" value="10">Elementary Schools</option>
</select>
if($$('select[alias=school_type]'))
{
var elv = $$('select[alias=school_type]');
var schoolType = elv[0].id;
data['type_id'] = $(schoolType).get('value');
}
Any help please
$$was sort of an alias fordocument.getElements(orSlick.findnow) and will always return a HTML collection–even when with 0 members. hence, theif ($$())assertion will not be falsy.either do
if ($$('selector').length)orif (document.getElement('select[alias=foo]'))instead, which will benullorelement objectso will evaluatefalsyRewrite this to: