0

if a jquery object is passed into a function, can I get the 'regular' js out of it so I can run things like:

foo($(this))

function foo(node){
    var jsnode = regular js object
    var num = (jsnode.id).substr((jsnode.id).length-1, 1);
}

If it's quite complicated I can just work with the jQuery... just curious!

2 Answers 2

5

You can either use the get method:

var jsnode = node.get(0); //Returns the node at index 0

Or you can use the array notation:

var jsnode = node[0]; //Also returns the node at index 0
Sign up to request clarification or add additional context in comments.

Comments

0

Yes, just access the regular JavaScript at node[0]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.