run jquery inside a JavaScript function

I have a html page where in some sections i'm using JavaScript and in other parts jQuery.

In a JavaScription funtion i'm doing stome stuff.

Is there a way to run a jquery selector inside a javaScript function?

See i have this selector:

$("#Textbox1")[0].disabled = true;

What's the equivalent of that in JavaScript?
LVL 1
maqskywalkerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leonidas DosasCommented:
If you want to use id then it must be a unique element.For more elements you can use class attr.If you are using an id then the selector goes to the first element that has it.
See below:
HTML:
<input type="text" id="textbox" />
  <input type="text" id="textbox" />
  <input type="text" id="textbox" />

Open in new window

JQuery script
var a=$('#textbox');
console.log(a);

Open in new window

Capture.JPG
Now if you are using a class atrr then the selector selects all the elements that have the same class:
HTML:
<input type="text" class="textbox" />
   <input type="text" class="textbox" />
   <input type="text" class="textbox" />

Open in new window

JQuery script:
var a=$('.textbox');
console.log(a);

Open in new window

Capture.JPGIn this case when toy choose the element [0] from the array elements you have this:
JQuery script:
var a=$('.textbox');
console.log(a[0]);

Open in new window

Capture.JPG
The above code in pure javascript code is this:
var a=document.getElementsByClassName('textbox');
console.log(a[0]);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maqskywalkerAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.