开发者

how to find control inside Wizard control in javascript

开发者 https://www.devze.com 2023-02-15 18:53 出处:网络
I have asp.net application having page with asp.net wizard control. this wizard control having the textbox controls. I want to access this textbox value in javascript.

I have asp.net application having page with asp.net wizard control. this wizard control having the textbox controls. I want to access this textbox value in javascript. where as i tried to access this text box control by this :

var originalPrice2 = document.getElementById('<%= mytextbox.ClientID %>').value;
or 
var originalPrice2 = document.getElementById('mytextbox').value;

but not getting any value .

where as I started firebug I found engine dynamically allocating the id to textbox control as "ctl00_ContentPlaceHolder1_Wizard1_mytextbox" and when i tried to get value of text box using this generated id.

var originalPrice2 = document.getElementById('<%= ctl00_ContentPlaceHolder1_W开发者_高级运维izard1_mytextbox.ClientID %>').value;

but getting exception :

The name 'ctl00_ContentPlaceHolder1_Wizard1_mytextbox' does not exist in the current context

Why should be this? my html is exactly same what i explained.


Try using jQuery:

alert( $("input:text[id$='mytextbox']").val());

OR

var originalPrice2 = document.getElementById('ctl00_ContentPlaceHolder1_Wizard1_mytextbox').value;
0

精彩评论

暂无评论...
验证码 换一张
取 消