javascript - jQuery - Childs -


i wondering how change specific child of element. in case want change first of ul. tried this:

[html , jquery]

<body>  <ul id="nav">     <a href="#"><li>1</li></a>     <a href="#"><li>2</li></a>     <a href="#"><li>3</li></a>     <a href="#"><li>4</li></a>           <a href="#"><li>5</li></a>     <a href="#"><li>6</li></a>     <a href="#"><li>7</li></a>     <a href="#"><li>8</li></a> </ul>  <div id="hidden">     <h1>text</h1>     <img src="#"> </div>  <script>     var main = function() {     var el1h1 = "text";     var el1p = "some text again.";         $('ul').child().click(function() {             $('#hidden').slidedown(1000);                });     };      $(document).ready(main); </script> 

try this

<ul id="nav">    <li>      <a></a>    </li>    <li>      <a></a>    </li>    <li>      <a></a>    </li> </ul>  $('#nav li:first-child').find('a').click(function() {         $('#hidden').slidedown(1000);        }); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -