a developer's notes – a semi-technical web development BLOG

September 5, 2011

Get a Javascript DOM object from a jQuery object

Filed under: Javascript / JQuery — Duy Nguyen @ 1:49 pm
Tags: , , , , ,

jQuery object is a wrapper around the js DOM object. If you want to get the DOM object from the jQuery object, you should use get() method.

For example, if the jQuery object includes only one DOM object, you can use




However, if you have multiple DOM objects, you can use


var myvar;
myvar= $(‘#<%=selectedProductionIdsHdnVl.ClientID%>‘).get(0);
myvar.value = “b”;

same as

document.getElementById(“<%=selectedProductionIdsHdnVl.ClientID%>“).value = “B”;

This allowed me to use the ASP Hidden field and have the OnValueChanged server side event get fired.

Blog at WordPress.com.