doubt in javascript
-
im using a js function to dynamically fill a dropdown. im using document.getElementById('dd') for getting the id of the select box. first it was working properly and now not. document.getElementById('dd') retuning a null and previosly it was returning a object. so im not getting the binding. what could be the problem :( sathy
-
im using a js function to dynamically fill a dropdown. im using document.getElementById('dd') for getting the id of the select box. first it was working properly and now not. document.getElementById('dd') retuning a null and previosly it was returning a object. so im not getting the binding. what could be the problem :( sathy
-
Have you checked the source of the page? What id does the dropdown get? If you moved the dropdown inside a container, the id can change. --- b { font-weight: normal; }
thanx a lot Guffa
Guffa wrote:
Have you checked the source of the page? What id does the dropdown get?
the id for the select tag is 'dd' only ...
Guffa wrote:
If you moved the dropdown inside a container, the id can change.
i cant get this above point:doh: ??? i dunno why im gettin that null:omg:... sathy
-
thanx a lot Guffa
Guffa wrote:
Have you checked the source of the page? What id does the dropdown get?
the id for the select tag is 'dd' only ...
Guffa wrote:
If you moved the dropdown inside a container, the id can change.
i cant get this above point:doh: ??? i dunno why im gettin that null:omg:... sathy
Well, if the id in the tag is correct, then there has to be something else in your code that causes the problem. Do you have any other element with the same id?
imsathy wrote:
i cant get this above point ???
If you put the dropdown in a user control, for an example, with the id "froglegs", the dropdown would get the id "froglegs_dd". If you put the dropdown in a repeater, each dropdown created would get a unique id, like "Ctrl_42". --- b { font-weight: normal; }
-
Well, if the id in the tag is correct, then there has to be something else in your code that causes the problem. Do you have any other element with the same id?
imsathy wrote:
i cant get this above point ???
If you put the dropdown in a user control, for an example, with the id "froglegs", the dropdown would get the id "froglegs_dd". If you put the dropdown in a repeater, each dropdown created would get a unique id, like "Ctrl_42". --- b { font-weight: normal; }
Guffa wrote:
If you put the dropdown in a user control, for an example, with the id "froglegs", the dropdown would get the id "froglegs_dd". If you put the dropdown in a repeater, each dropdown created would get a unique id, like "Ctrl_42".
thanx for the explanation. but im using the select tag on the same page.
Guffa wrote:
Do you have any other element with the same id?
i tried keeping some unique name. but null is wat it returns if check tat wit a alert. but my previous similar coding in the source gear is workin perfectly sathy
-
Guffa wrote:
If you put the dropdown in a user control, for an example, with the id "froglegs", the dropdown would get the id "froglegs_dd". If you put the dropdown in a repeater, each dropdown created would get a unique id, like "Ctrl_42".
thanx for the explanation. but im using the select tag on the same page.
Guffa wrote:
Do you have any other element with the same id?
i tried keeping some unique name. but null is wat it returns if check tat wit a alert. but my previous similar coding in the source gear is workin perfectly sathy
Test by giving the element a different id, just to see if that makes the javascript work. Also check for other errors in the page source. For an example, if the element is placed outside the form, it might be ignored by the browser. --- b { font-weight: normal; }
-
Test by giving the element a different id, just to see if that makes the javascript work. Also check for other errors in the page source. For an example, if the element is placed outside the form, it might be ignored by the browser. --- b { font-weight: normal; }