if/else doesn't work
if/else doesn't work
hello,
I have a jquery script. The meaning is, when you have 4 divs in the browser then the first div hide.
You must only see 3 divs and not more.
I have written but it doesn't work.
Can someone help me?
thanks in advance.
- <!DOCTYPE html>
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
- <script>
- $(document).ready(function(){
- if($( "div" ).html() == 4; ))
- {
- $( "div:first").hide();
- }
- });
- </script>
- </head>
- <body>
- <div><p>This is a paragraph with little content.</p></div>//this div is not hide.
- <div><p>This is another small paragraph.</p></div>
- <div><p>This is a test</p></div>
- <div><p>fourth div </p></div>
- </body>
- </html>