this worksPut below after your </form> tag:
external script file ekak nam onnam udin dala defer daanna..
this worksPut below after your </form> tag:
onchange ekene aula thiyenne display ekata enakal code eka run venne na. a nisa display style part eke aulak nemeDefault value rkak deelafa balanna dropdown ekata.
Nathnm display wenuwata visibility propery use krnna balanna.
------ Post added on Jun 24, 2023 at 2:23 AM
css eken important ain kaloth enne na. eth real code ekedi css eke important ain karanna ba. ethakota page eka load veddi display vela thiyenne hide venna one fields tikame fiddle eke issue eka enne na neda
baluwa hariyanne naMatath methana aul wage
Onload function ekata daala balanna js code eka
https://www.w3schools.com/jsref/event_onload.asp
meka plugin ekak vidihata hapu ekak machan. hook ekakin form ekakata sambanda karala thiyenne me fields tika venama thiyenne. ID eke hari deveniyata kiyapu eka venna widihakuth na man footer eke yatatama dalath baluwa script eka eth hariyanne na. Same error.null ekaka onchage set kranna ba kiyala ne kiyanne
meke null eka wenne selectElementOrc1 variable eka neda
eka null wenne element eka hariyta selct wenne nathi nisa.
element eka hariyta select wenne naththe ekko wrong id, or element eka thama dom eke na
meka plugin ekak vidihata hapu ekak machan. hook ekakin form ekakata sambanda karala thiyenne me fields tika venama thiyenne. ID eke hari deveniyata kiyapu eka venna widihakuth na man footer eke yatatama dalath baluwa script eka eth hariyanne na. Same errorPut below after your </form> tag:
meka plugin ekak vidihata hapu ekak machan. hook ekakin form ekakata sambanda karala thiyenne me fields tika venama thiyenne. ID eke hari deveniyata kiyapu eka venna widihakuth na man footer eke yatatama dalath baluwa script eka eth hariyanne na. Same errorthis works
external script file ekak nam onnam udin dala defer daanna..
THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS!The issue with your code is the use of `!important` within JavaScript to change CSS styles. The `!important` rule is a part of CSS and it's not supposed to be used with JavaScript in this way. It has no effect in JavaScript and can cause your code not to work as expected.
Here's the correct code:
```javascript
const selectElementOrc1 = document.getElementById('meta_orcapplicable');
const displayElementOrc1 = document.getElementById('new_orcincluded');
selectElementOrc1.onchange = function() {
if (selectElementOrc1.value === 'Applicable') {
displayElementOrc1.style.display = 'block';
} else {
displayElementOrc1.style.display = 'none';
}
};
```
This will show and hide your `displayElementOrc1` based on the value of `selectElementOrc1`. However, if you have some CSS rules that are using `!important` to set the display of `displayElementOrc1` and you still want to override them from JavaScript, you will need to use CSS classes instead.
For instance:
```css
/* Add this in your CSS */
.display-block-important {
display: block !important;
}
.display-none-important {
display: none !important;
}
```
And your JavaScript will be:
```javascript
const selectElementOrc1 = document.getElementById('meta_orcapplicable');
const displayElementOrc1 = document.getElementById('new_orcincluded');
selectElementOrc1.onchange = function() {
if (selectElementOrc1.value === 'Applicable') {
displayElementOrc1.classList.remove('display-none-important');
displayElementOrc1.classList.add('display-block-important');
} else {
displayElementOrc1.classList.remove('display-block-important');
displayElementOrc1.classList.add('display-none-important');
}
};
```
This will effectively override any existing CSS rules with the `!important` declaration.
CSS eke important ain kaloth Applicable select kalath nathath display vela thiyenawa. ප්රශ්නේ විසඳුනා මචන් උඩ Reply එකේ තිබ්බ විදිහට කලාම.css, js දෙකේම !important කෑලි දෙක අයින් කරන්න. වැඩ කරනවා
උබේ ඔය කෝඩ් එක රිවිවු කලොත් නම් අබ සරණයි හොදේ. මේක දාපන්.
meka plugin ekak vidihata hapu ekak machan. hook ekakin form ekakata sambanda karala thiyenne me fields tika venama thiyenne. ID eke hari deveniyata kiyapu eka venna widihakuth na man footer eke yatatama dalath baluwa script eka eth hariyanne na. Same error.
THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS! THIS WORKS!
THANK YOU BRO!![]()
එහෙම ෆයිල්ස් දෙකක වැඩේ වෙන නිසා තිබ්බ අවුලක් නෙමේ කියලා මට තේරුණා. මන් දාලා තිබ්බ කොටස් ටිකේ තමයි අවුල තියෙන්න ඕනේ කියලා හිතුනේ. ඒකයි ඒ ටික විතරක් දාලා ඇහුවේ. ඇත්තටම අවුල තිබ්බේ දාලා තිබ්බ කෝඩ් එකේනේඑහෙම මගුලක් උබ කලින් කිය්ල නෑනේ.. නිකං ෆිඩල් එකක් දාල වැඩ නැත්තෙ ඇයි කියල අහනවා.. දාද්දි කන්ටෙක්ස්ට් එකත් එක්ක දාපං මුලින්..
![]()