How to check an element is exist in a form using JQuery or not?

Options :
  1. if (#("myControlId")){
      // your logic goes here
    }
    
  2. if ($("#myControlId").exists){
      // your logic goes here
    }
    
  3. if ($("#myControlId")){
      // your logic goes here
    }
    
  4. if (exists("#myControlId")){
      // your logic goes here
    }
    
Answer and Explanation :-

Answer: Option 3

Explanation:

You can use check the element is exists or not using simple if statement and the control id of an element for eg

if ($("#myControlId")){
  // your logic goes here
}

How do you rate this queston?  Very Easy  Easy  Average  Above Average  Tough

Previous Question : How to remove css class using JQuery?

Click here for online test on JQuery

More available Categories:-

Responses


 (Getemail alerts when others member replies)







Appreciate all people for their talents. Everyone has something positive to contribute. If a rainbow only had one color, it wouldn't be as beautiful or spectacular to see.
-Susan Reid Divinity: The Gathering