Search code examples
yui

How to use find function in YUI3? And how to find meta tag list?


Like jQuery we can collect the array of matched DOM element of class 'anything'
with the help of 'find' function
Can i have same functionality in YUI3?

Edit 1:

As i have website source code with the help of php 'file_get_content' function
and i want to find the list of meta tag by YUI3.

Here i used module named
1. io-base : to get the website source code in ajax mode
2. node : to implement functionality over code.

May i know how to parse the responseText to get the list of meta tag?


Solution

  • You can find the collection of all matched elements like this.

    YUI().use('node', function(Y){
    var myElements = Y.all('.classname');
    });
    

    If you are using the io module the user guides may help.

    if the format of your response is something like json, you would include the json module and parse the responseText to json and then just treat it as an object. If it's xml that you get back use the responseXML returned via the io call and use the native xml dom functions. (The examples linked on the user guide shows just this type of work)

    Also, if you are used to jQuery try the rosettastone site