Ex: On click of button, In desktop version screens it should display prompt message as ' Hi'. . same on click in mobile screen sizes it should display prompt message as "Hello".
            Asked
            
        
        
            Active
            
        
            Viewed 62 times
        
    0
            
            
        - 
                    you can use modal of bootstrap. It's responsive for all kinds of screen. – Akhter Al Amin Jan 26 '17 at 07:15
- 
                    What you have tried before. show some code as well. – Ataur Rahman Munna Jan 26 '17 at 07:25
- 
                    × This is an alert box. – Prudhvi baseedu Jan 26 '17 at 12:33
2 Answers
0
            
            
        Check this answer out. Then after getting the width of your screen you can
getElementById("my_element").innerHTML() and set whatever you want to. 
 
    
    
        Community
        
- 1
- 1
 
    
    
        catchiecop
        
- 388
- 6
- 24
0
            You could do something like this:
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
$('#btn').on('click', function() {
  if (width > 480 && height > 800) {
    alert('hi');
  } else {
    alert('hello');
  }
});<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="button" id="btn" value="Click me" /> 
    
    
        Calum
        
- 1,889
- 2
- 18
- 36
