Goal, is to extract the content for the CKEDITOR Text Editor, and then only obtain the FIRST paragraph. For some reason the bellow isn’t working… Ideas?
Given the following JavaScript:
var newTitle = CKEDITOR.instances.meeting_notes.getData();
newTitle = $(newTitle).find("p:first").text();
It doesn’t work because
find()searches the descendants and your paragraph must be at the top level of the HTML you’re searching.For example:
returns “undefined” whereas:
will output “one”.
So you could use
filter()if you know it’s at the top level (possibly falling back tofind()). Alternatively you could wrap the whole lot up in a dummy element:Edit: My advice? Use: