Olivier
Olivier

Reputation: 130

jQuery, get ID of a textarea

I've got a form with a text field defined as follow:

<textarea style="height: 60px; width: 100%;" name="F3414" id="F3414" rows="6" cols="80" wrap="virtual" class="frmTxa fckEditor"></textarea>

I need, using jQuery, to get the textarea id (in that case, F3414).

I've tried:

$('textarea .fckEditor').attr('id'); 
$('.fckEditor').attr('id'); / ... with no luck.

Any idea?

Thanks a lot

Upvotes: 0

Views: 8562

Answers (2)

clairesuzy
clairesuzy

Reputation: 27664

alert($('textarea.fckEditor').attr('id'));

you have a space between textarea .fckEditor in your original question, does removing it make a difference

Working Example : here

Upvotes: 2

rahul
rahul

Reputation: 187110

If you are using the textarea as an editor, it won't be rendered as a textarea once the plugin is applied. It might be an iframe with content editable set to on.

Inspect the page source using firebug and try to find out the HTML structure.

Upvotes: 1

Related Questions