Hi I am migrating code from javascript to jquery.
What would be the equivalent jquery of the following javascript.



Troy III commented: An original working solution has already been handed to you - you need to say THANK YOU and mark your thread as "Solved" -2

Here are some examples using jQuery selectors...

$('p')    // Selects all paragraph elements
$('#one')   // Selects element with an ID = 'one'
$('.nav')   // Selects elements with a class = 'nav'

Just out of curiosity, why do yoiu even have document.getElementById("#elementname").getElementsByTagName('tagname');, ids are supposed to be unique on the page, there is no need for the getElementsByTagName

@stbuchok because the elementname is actually a regular expression.

you could include my underdot lib

_ = document.getElementsByTagName("*")||document.all;

and use it like:


(instead of re-coding your project to accomodate jquery syntax)
its common syntax is: _.Id;