0

I am working on a simple program which lets users to add some text when clicking on add text button. However, when user clicks again on the "add Text" button, a new text area should not be added instead the present textarea should be focused or if it is hidden, it has to be made visible.

This should be done using jquery.

any ideas ?

Sai Varadula
  • 103
  • 1
  • 3
  • 5
    Hi, please always remember to Google first. Searching `how to know if a div with specific id exists using jquery` literally gives you the right answer. Thanks! – Pekka May 06 '13 at 06:41

1 Answers1

20

Simply

if ($('#myId').length) {
     // div exists
}
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758