Cesy (
cesy) wrote in
dw_dev_training2009-10-09 04:45 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[site community profile]](https://www.dreamwidth.org/img/comm_staff.png)
Entry tags:
More Javascript help, please
I have a link, and when you click on it, it calls
I then have a function defined:
What I'm aiming for is that tagname is added to the list already in prop_taglist, which is the id for the tags input box. However, the code above doesn't work - nothing happens when I click on the link. Can anyone tell me what I'm doing wrong, or give me any tips on how to debug Javascript like this?
edit_tagcloud(tagname);
.I then have a function defined:
function edit_tagcloud(newtag)
{
if (! newtag) return;
var cur_taglist = document.getElementById('prop_taglist').value;
if (cur_taglist.length > 0) {
cur_taglist = cur_taglist + ", " + newtag;
} else {
cur_taglist = newtag;
}
document.getElementById('prop_taglist').value = cur_taglist;
}
What I'm aiming for is that tagname is added to the list already in prop_taglist, which is the id for the tags input box. However, the code above doesn't work - nothing happens when I click on the link. Can anyone tell me what I'm doing wrong, or give me any tips on how to debug Javascript like this?
no subject
Okay, I thought of something that might make this fail...if prop_taglist is undef, there won't be a value on it. And actually, if it's defined but empty, then I think .value might give you undef instead of an empty string, which then isn't a valid string. So check for that.
no subject
no subject
no subject
Reference, please?
http://www.w3.org/TR/CSS21/syndata.html#syntax defines an identifier of starting with an optional '-', followed by a "nmstart" character and one or more "nmchar" characters, and the underscore is explicitly included in both "nmstart" and "nmchar".
no subject
- Is edit_tagcloud called at all?
- Is that statement: returning prematurely?