ambuli
asked on
Jquery to update a label
Hi there,
I have the following JS.
var expandCollapseLabel = document.createElement("la bel");
expandCollapseLabel.id = "ExpandCollapseLabelID";
expandCollapseLabel.innerH TML = "-";
Later on, in another function I have to update the label.
I tried the following. It is getting called, but the label is not updated. How can I do this? Thanks.
$("#ExpandCollapseLabelID" ).val("+") ;
I have the following JS.
var expandCollapseLabel = document.createElement("la
expandCollapseLabel.id = "ExpandCollapseLabelID";
expandCollapseLabel.innerH
Later on, in another function I have to update the label.
I tried the following. It is getting called, but the label is not updated. How can I do this? Thanks.
$("#ExpandCollapseLabelID"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
.val() is used for input elements not Label's - you have to treat the label as you would any other text element.
You also seem to be mixing JQuery and straight javascript - to update the element using JQuery as you are attempting you can do this
You also seem to be mixing JQuery and straight javascript - to update the element using JQuery as you are attempting you can do this
$("#ExpandCollapseLabelID").html("+");
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window