Sometimes we will face an issue to read the drop down values in java script function, then the below code may be use full.
Note :- In chrome browser onclick function will not work.
<aui:select name="selectvideo" id="selectvideo1" label="Select Video" onChange="getPrice()">
<aui:option value="-1" >
<liferay-ui:message key="select-video" />
</aui:option>
<script>
function getPrice() {
var sel = document.getElementById("<portlet:namespace/>selectvideo1");
document.getElementById("<portlet:namespace/>key").value = sel.options[sel.selectedIndex].value;
}
</script>
Note :- In chrome browser onclick function will not work.
<aui:select name="selectvideo" id="selectvideo1" label="Select Video" onChange="getPrice()">
<aui:option value="-1" >
<liferay-ui:message key="select-video" />
</aui:option>
<script>
function getPrice() {
var sel = document.getElementById("<portlet:namespace/>selectvideo1");
document.getElementById("<portlet:namespace/>key").value = sel.options[sel.selectedIndex].value;
}
</script>
3 comments:
I ordinarily never comment on code advice online, but I couldn't find an example like this anywhere and it solved a problem I've been working on for hours. thank you very much!
Thanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work. 经济代写
Thank you
Post a Comment