get the id of a textarea from this html form with jQuery

Need help getting and using the id of a textarea so that I can replace it with a ckEDITOR.

So here is the html output:

NOTE: This is the output of a foreach loop, for every database result, this is the html output and the textarea ID is a number generated from the id of the row.

<div class="blogtest" id="514">
<form action="process/updatepost.php" class="updatepost" method="post">
<input type="button" class=edity value="Edit">
<div class="text">
<div class="buildtext" id="514">3</div>
<div class="editor">
<textarea name="muffin" id="516" class="ckeditor">3</textarea>

And here is the jQuery im using:

var editorID = $(this).find('.ckeditor').attr("id")

This doesnt work, I'm not the most advanced with jQuery so not sure why. But i get a type b is undefined error in my console log.

Also just to note; this works:


but the text areas are loaded dynamically in a foreach loop and I can't be creating a replace code for 1000's of editors...


You are looking for the .checkeditor element from the .edity element. Instead you can do:

$(document).on('click','.edity',function() {
    var editorID = $(this).parents('.blogtest').find('.ckeditor').attr("id");

Need Your Help

How to make the main thread wait for the other threads to complete in ThreadPoolExecutor

java multithreading threadpool

I am using the ThreadPoolExecutor to implement threading in my Java Application.

Function Reference/shortcode exists in wordpress

php wordpress wordpress-plugin

how can i understand a short code is exist in my wordpress post?