I'm new to jQuery and I'm looking to use it to select the current menu item (because it's your Looks in hover position.)
My alert is firing, so the function is starting. When this comment is not made, the first description, the background color works yellow. However, I can not find others in influencing the menu "selected" class does not seem to work. In other words, the item that I select in the menu is highlighted in yellow until the page changes, then it goes back to the default color. I have tried several combinations to select, including the Sylhet class is. Only selected.
jQuery & lt; Script & gt; $ (Document) .ready (function () {$ ('. Nav ul li'). (Function () {Warning ("go!"); / * $ ('A', this) .css (" Background $ ('A', this) .addClass ('selected');})}}; & lt; / scripts & gt; HTML ; A href = "index.php" & gt; HOME & lt; / a & gt; & lt; / li & gt; & lt; li & gt; & lt; a href = "about.php" & gt; ABOUT & lt; / li & gt;
a href = "k-5.php" & gt; K5 projects & lt; strong class = "Carat"> a href = "wishlist.php" & gt; & lt; / li & gt; & lt; / li & gt; ; LIST LIST & lt; / a & gt; & lt; / li & gt; & lt; li & gt; & lt; a href = "history.php" & Lt; li & gt; & lt; a href = "funlinks.php" & gt; Fun LINKS & lt; / a & gt; Gt; & lt; / li & gt; & lt; li & gt; & lt; a href = "contact.php" & gt; Contact & lt; / A & gt; & Lt; / li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; CSS .nav ul li a: active {background color: # FFB01C; } .nav ul li a: hover {background-color: # FFB01C; } .nav ul li .selected {background-color: # FFB01C;
To ensure that it uses this code
& lt; Script & gt; $ (Document) .ready (function () {$ ('. Nav ul li'). Click (function () {// following code event.preventDefault (); Alert ("Go!"); / * $ ( ('A', this). CSS ("background-color", "yellow"); * / $ ('A', this) .removeClass ('selected'); $ ('A', this) .addClass (' Selected'); }); }); & Lt; / Script & gt; This will prevent the page from reloading. Or you should save the list item that the user clicks inside the cache or cookie, and then the style changes on that data.
As already mentioned in comments by j08691, your change is being implemented. But as soon as the new document (new page) is loaded in the browser, changes are made. You are also mentioning this problem.
I made some changes, here you can check them
jQuery was turned into a selector,
$ ('. Li ') Since you are enforcing the class in the list, therefore $ ('. Nav ul li ') was not working. The second change is described above. The page was loading because you are hyperlinking in your code. He has to take his document to the next one (next document load), to stop it, I added the code now it works.
Popular posts from this blog
I am trying to learn PDO, now I have written this small code, but it gives me a serious error: Fatal error: Call a member function at a non-object dot () ... $ con = new mysqli ("127.0.0.1", "root", "", "csvdangercheck"); $ Query = $ con- & gt; ("Id,` var1`, `var2`) values (" id,: var1,: var2) ";); $ query- & gt; bypass pattern (': id', $ id); $ query- & gt; BindParam (': var1', $ VAL1); $ Query- & gt; bindParam (': var2', $ val2); $ Query-> Executed (); I Trying to use print_r ($ con-> errorInfo ()) but Fatal error: Undefined method mysqli :: errorInfo ( ) ... can someone tell me what am I missing? Flaffeh said, you have PDO Missing Mysqy, try it: $ con = new PDO ('mysql: host = 127.0.0.1; dbname = csvdangercheck', 'root', '');
I have a 6 digit number and a 31-digit number (such as "234536" and "201103231043330478311223582826") that I The API needs to be crawled in the same 22-character alphanumeric field that uses PHP. I tried to convert each one to 32 (using custom code could not handle the base_convert () large number) and to connect with a single-character delimiter, but It only gives me 26 characters This is a restore API, so the letters should be URI-protected. I would like to do a database table cross with two references without reference to another reference value, if possible, any suggestions? Instead use a radix of 62. This will give you 22 characters for the top, 3.35 for the pre and 17.3 for the next. & gt; & Gt; & Gt; Math.log (10 ** 6) /math.log (62) 3.3474826039165504 & gt; & Gt; & Gt; Math.log (10 ** 31) /math.log (62) 17.295326786902177
Please help me about this question: Look for functions ($ userpno) } {Echo $ userpno; $ This-> query = "SELECT task.employee_id, task.user_id, task.service_id, service.name AS servicename, service.description AS servicedescription, employee.name as employineame, employee.pic_path employment, employee.pic_path from work Work.user_id = '$ userpno' Join the INNER employee. Pno = task.employee_id Join INNER user user.pno = task.user_id service.service_id = task.service_id "INNER service; } query works perfectly without: WHERE task.user_id = '$ userpno' my Also try this method: WHERE task.user_id = $ userpno but it does not work. Error: Warning: mysqli_fetch_array () parameter 1 is expected to be mysqli_result, given in Boolean C: \ wamp \ www \ admin \ classes \ Task Php on line 22 Please tell me where I say where is it. Try: $ this-> query = "SELECT Task.employee_id, task.user_id, task.service_id, service.name AS s...
Comments
Post a Comment