views:

8

answers:

1

This code will return true if the browser supports selectionStart and some text is selected, but if no text is selected it returns false (even on browsers that support it):

   if (el.selectionStart) {

  }

How do you determine if the property is available regardless of whether text happens to be selected?

Thanks

A: 

Further googling revealed the answer:

 if (el.selectionStart != undefined) {

 }
Tim