JavaScript Issue during pageload

I am trying to create a rodiobuttongroup which should change the layout from vertical to horizontal when orientation is changed from portrait to landscape. I am able to do that,but the only problem is I am not getting it during page load but when I am changing the orientation its reflecting.

$(window).resize(function () {
        var mql = window.matchMedia("(orientation: portrait)");
        if (mql.matches) {
            $("#id_cdscradiobtn").dxRadioGroup({
                items: CDSCRadioGroup,
                value: CDSCRadioGroup[0],
                layout: "vertical"
            });
        }
        else {
            $("#id_cdscradiobtn").dxRadioGroup({
                items: CDSCRadioGroup,
                value: CDSCRadioGroup[0],
                layout: "horizontal"
            });
        }
    });
Answer:1

I'm trying to apply the css for a specific hovered image but my code is applying the css for all images when hover only 1 image. $(document).ready(function() { $('.vidUrl').on('hover', ...

I'm trying to apply the css for a specific hovered image but my code is applying the css for all images when hover only 1 image. $(document).ready(function() { $('.vidUrl').on('hover', ...

I am trying to iterate an array with forEach and, based on a condition, I do something. For this question, I simplified the condition in order to try to understand what's going on. I expect array b =...

I am trying to iterate an array with forEach and, based on a condition, I do something. For this question, I simplified the condition in order to try to understand what's going on. I expect array b =...

I have a list of images like so: <div> <div class="imgCnr"> <img src="abc.jpg"> </div> <div class="imgCnr"> <img src="def.jpg"> </div&...

I have a list of images like so: <div> <div class="imgCnr"> <img src="abc.jpg"> </div> <div class="imgCnr"> <img src="def.jpg"> </div&...

  1. select parent element css
  2. select parent element javascript
  3. select parent element jquery
  4. select parent element xpath
  5. select parent element sass
  6. select parent element js
  7. select parent element using css
  8. select parent element selenium
  9. select parent element using javascript
  10. select parent element from child css
  11. select parent element
  12. select parent element scss
  13. select parent element css3
  14. select parent element with class
  15. select parent element angular
  16. select parent element using jquery
  17. select parent element html
  18. select parent element from iframe
  19. select parent element of class css
  20. select parent element angularjs

I am trying to call a function that isn't being recognised. I have a PHP block of code that adds the form to the HTML when the user is logged in: <?php if(isset($_SESSION['user'])) { $usr = $...

I am trying to call a function that isn't being recognised. I have a PHP block of code that adds the form to the HTML when the user is logged in: <?php if(isset($_SESSION['user'])) { $usr = $...

  1. onsubmit call javascript function
  2. onsubmit run javascript function
  3. onsubmit call js function
  4. onsubmit javascript call
  5. call onsubmit js
  6. html form onsubmit call javascript function
  7. html onsubmit call javascript function