Leaderboard


Popular Content

Showing most liked content since 08/17/2016 in all areas

  1. 2 likes
    Like astralaaron said using closest class and the index class in jquery you can get the index of the tr, have a look at the fiddle. https://jsfiddle.net/8hL46ftj/ hope this helps $('img').click(function(){ alert($(this).closest('tr').index()) })
  2. 1 like
    I don't know where there's a list. Generally you should never develop for specific devices, you should just make your layout flexible enough (with help of media queries) to wotk on any screen regardless of size. This is usually achieved by testing your page in the responsive mode of your browser and resizing the viewport until it breaks, then you add a media query to correct the layout. But for reference, I start off with a design for the following devices, then make extra adjustments later: Small mobile (iPhone 4):Up to 374px (I usually use this just for specific elements that didn't fit) Mobile or small mobile in landscape): Up to 767px Tablet portrait: 768px Tablet landscape: 1024px (breakpoint usually between 800px and 900px) Desktop: 1025px and above Some people make designs for large desktop computers (1440px and above), but that's up to you. In general, there isn't one specific strategy for responsive design, this is just the approach from the companies I work with.
  3. 1 like
    How can I? I don't know what or how it is replacing the checkbox? it is not necessarily bootstrap on its own, could include jQuery. I can only give exact answer by seeing the problem in action by link to the page in question, to identify what element/class needs to be targeted.
  4. 1 like
    Yes, if you are only communicating via the internet, and not using a browser, but each language is different. You would not use the same code or probably even the same language in Windows as you would in Linux.
  5. 1 like
    It only shows the source of files in the same local filesystem, regardless of domain name. If, for some reason, it did load a file from a URL it would only be able to show what was returned by that URL through HTTP.
  6. 1 like
    There is no Php.ini file, where would be if not in the file manager? Nothing occurs. Blank screen once I tested the email form. The code doesn't go back to the form page, I removed that, but the Mysql db should contain the record, but nothing.
  7. 1 like
    div>p {background-color: yellow;} Will set paragraphs that's a direct child element of parent element div with background yellow https://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_element_gt it won't change paragraphs nested within other child elements of the div parent. div p {background-color: yellow;} will change ALL child paragraphs within parent div whether they are nested or not. :root will target the <html> element, it being the outermost containing element (root) * universal selector: meaning target ALL elements. : single colon used for pseudo classes such as :hover, :link, : visited :: used for pseudo element ::after, ::before used to create content before or after a elements content, NOTE: older IE browsers use the single colon, but both can be used for modern better browsers than IE and Edge.
  8. 1 like
    * Is known as wildcard symbol so if value appears anywhere within class attribute value ^ Is 'begin with', so if value appears at beginning of class attribute value. $ Is 'end with', so if value appears at end of class attribute value. https://www.w3schools.com/css/css_attribute_selectors.asp
  9. 1 like
    You can use Ajax to load data(images, text ....) from a separate file which contains php,asp, txt depending on what you are using once the data is ready to be displayed you can use w3 animation to make it look fancy . Here's the ajax tutorial Ajax.
  10. 1 like
    I'm not sure what code you're using to get the mouse offset, but once you have it you can calculate the correct position by dividing the canvas real size by its visible size. // Assuming we already have a reference to canvas and the mouse's position // relative to it is in visibleX and visibleY var horizontalRatio = canvas.width / canvas.offsetWidth; var verticalRatio = canvas.height / canvas.offserHeight; var realX = horizontalRatio * visibleX; var realY = verticalRatio * visibleY; // Do something with realX and realY
  11. 1 like
    Open your browser's developer tools and go to the Network tab, refresh the page and look for any failed requests to see what's missing.
  12. 1 like
    Place both if conditions for setting modal and login to display none, in a single window.onclick function
  13. 1 like
    If you're going to ask the same question, then it's going to be the same answer: If you don't want to use PDO and have it throw exceptions when you make a mistake, then you need to check for errors yourself. If prepare returned false, then you need to print the error message from MySQL. You have a problem with the SQL query you're trying to prepare. You changed the format of that UPDATE query between the two pieces of code and now the query is wrong. UPDATE queries do not use the same format as INSERT queries.
  14. 1 like
    It is so much much easier to do it in PDO, why don't you use it ? And it is even more secure. dbconnection: try { $username = "db_username"; $password = "db_password"; $db = new PDO("mysql:host=localhost;dbname=your_dbname", $username, $password); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected !"; } catch (PDOException $e) { echo $e->getMessage(); } then your script to insert those values: try { $sql = "UPDATE users SET Username=:username, Email=:email, EmployeeID=:empid, Designation=:design, Password=:password WHERE Id = :id"; $stmt = $db->prepare($sql); $stmt->bindParam(":username", $username); $stmt->bindParam(":email", $email); $stmt->bindParam(":empid", $employee); $stmt->bindParam(":design", $designation); $stmt->bindParam(":password", $password); $stmt->bindParam(":id", $id); if($stmt->execute()){ echo "<font face='Verdana' size='2' color='green'> You have successfully updated your profile <br /> </font>"; } else { $msg = "<font face='Verdana' size='2' color='red'> There is some problem in updating your profile. Please contact site admin <br /></font>"; } } catch (PDOException $e) { print_r($e->getMessage()); } This is a clean way to do what you want but in PDO not MySQLi.
  15. 1 like
    Upon refreshing, the video is still uploaded to database ? Not the folder, because i might be thinking that it displays you the page because in database there is a video saved with an url but on your host in the videos folder there is no video with the url from db, that's mostly why you have that error.
  16. 1 like
    That custom 404 page doesn't give a lot of information, it doesn't help that it redirects to 404.html. Maybe the redirection isn't working. The normal way to redirect though is to send a Location header with the new URL. But, for testing, I would suggest not redirecting and making sure the PHP code works. Your PHP code has some errors in it, so maybe the server sees the PHP errors and redirects to 404 for some reason. Here are some of the issues with your PHP code: You're trying to call a function called $POST, but $POST isn't defined. If you want to get submitted values you get them from $_POST, which is an array, not a function. So, for example, you would use $_POST['name']. If your database connection fails you don't stop the script, the rest of the code still runs without a database connection. When you call mysqli_query, you used !$con which is going to send a boolean value instead of the actual connection. You need to use prepared statements when you're sending data to the database. The mysqli extension supports prepared statements, you need to use them to make sure your queries run and protect against SQL injection attacks. You send the same text ('Not inserted') regardless of whether or not the record was inserted in the database. If you use echo to send any output, sending a header after that will not work.
  17. 1 like
    No! the PHP file in its present state should not be included in to the form page, it is AJAX specific because of the if condition, which should be access by JavaScript AJAX code that uses url to that php file to retrieve required data using server script language PHP. I don't know what jquery.js is? is it the users own custom code or jquery framework code? either way it is perfectly all right if not the norm to place js code at bottom of page, as it will help in loading of page quicker as html and css needs to loaded primarily first, and JavaScript secondary as most of the time JavaScript is triggered by events by the user after the page is fully loaded. The main problem with include ("jquery.js"); is that is needs to be within <script>...</script> tags if custom js code, OR if jQuery framework file, it should link to it, using for example <script type="text/javascript" src="jquery.js"></script>
  18. 1 like
    <form method="post" name="form_name" id="form_name" action="https://www.w3schools.com/comment.php"> <fieldset> <legend>Title</legend> <p>A brief explanation about what you would like to see entered.</p> <textarea name="comment" form="form_name" maxlength='400' rows="8" placeholder='Character Limit: 400'></textarea> </fieldset> <input type="submit" value="Submit comment"> </form> In addition you must decide what you want to do with the comments and how to process them one they are received via the post ($_POST) method at comment.php. Roddy
  19. 1 like
    The superglobal is like any other variable in the PHP process, it only exists during the time the script is running. If you want to store its value permanently somewhere you can use a database or write it to a file. If you want to store something for one user during a browsing session you can use PHP sessions.
  20. 1 like
    The RSS file can go anywhere you want, you just have to tell people where to find it. As I mentioned earlier, you can tell browsers where to find a feed by putting a <link> tag in your HTML page. There's no real best practice as to where to place your RSS feed files. I think RSS feeds have to use absolute URLs in the <link> tags including protocol and domain name to point to the location of the files. If you want a URL like "/feed" for your RSS feed you would have to use URL rewriting on the server, a regular URL would look like this instead: "/feed.xml" or "/feed.rss".
  21. 1 like
    These Email = $Post('email'}; $Password = $Post('Password'}; are supposed to be $_POST['email']; AND $_POST['Password']; and the coloured names are suppose to match the values of name attributes of inputs you are trying to read <input type="text" value="username"><br> Password:<br> <input type="text" name="lastname" value="password"><br><br> AS you can see, they match neither, and one does not even have a name attribute which is required for ALL inputs, AND name values must match exactly as 'password' is treated differently to 'Password'.
  22. 1 like
    It looks to me like hiding the menu was not a mistake but a deliberate part of the design. The menu wouldn't fit as it is on a mobile screen. I can't check the code right now, I might get to it later. You should use your browser's inspector to see which CSS rule is hiding the menu.
  23. 1 like
    The save() and restore() methods are useful for that. save() remembers the current state, restore brings back the state of the last save() call. ctx.save(); // Remember the current state ctx.translate(100,100); ctx.fillRect(0,0,100,100); ctx.restore(); // Return to the previous state ctx.fillRect(100,100,50,50);
  24. 1 like
    https://www.w3schools.com/php/php_file_upload.asp
  25. 1 like
    Yep. The alternative is to not list the columns in the table and only give the values: INSERT INTO table VALUES ('val1', 'val2', 'val3') But, like I said, if you ever change the structure of that table then that query is going to break if you've changed the number of columns. It's best to just list everything out explicitly. You don't have to pay per character in your source code, make the code as obvious as possible so that it's easy to maintain. Ease of maintenance should always be a higher priority than something like how long the code is.
  26. 1 like
    If you're using mysqli in PHP then you still need to write the SQL code. mysqli is just an extension for using MySQL, it's not an abstraction layer like you would get with Zend Db or something where you're building PHP method calls instead of writing SQL queries.
  27. 1 like
    I understand that an RSS feed is XML, but the links that go in that XML, the software used to create the XML, and the server security aren't related to XML. That's why I was asking why a question about directory security was in the XML forum. IIS is Internet Information Services, the Microsoft web server that runs on Windows. You didn't say what your environment was so I pointed out that URL rewriting can be done using htaccess in Apache, or another way in IIS. I assume nginx and other web servers also have a way to set up URL rewriting. Linux isn't a web server, it's an operating system, like Windows. Apache, nginx, IIS, etc are web servers. Your Linux server is probably running Apache. Yes. Like I mentioned, browsers often send partial requests for audio or video content. If you don't support that then the client will wait until the entire file finishes downloading before starting to play it. I'm not aware of a class that will do everything, when I implemented directory security and authorization through PHP I wrote that myself. Things might have changed since then. There might be something for your web server, like an Apache module, which is built to take a request and run a PHP script to handle authentication and authorization, or maybe a module that would check your database directly without going through PHP. I looked into some of those things but at the time I didn't find anything that perfectly matched what I was trying to do.
  28. 1 like
    The container and image are 960px wide, the .picture class element has 5px padding, the image has no percentage sizing to make it responsive, so it remains 960px wide, the 960px image is pushed because of padding 5px to the right forcing the 960px wide image to extend beyond the boundaries of .container and .picture class elements.
  29. 1 like
    Each time you click a button you will have to loop through the panels array and compare its elements with the button's value. If the value was found then don't add it to the array. A for() loop and a boolean variable should be enough to do that.
  30. 1 like
    You can probably use the manifest to list every file on your site, but that's not going to necessarily make browsing faster, it might just cause the browser to sit there and download everything the first time they visit any page. It's better to have the browser cache everything as it needs it rather than to download your whole site the first time they visit any page.
  31. 1 like
    You can use scandir() to list files in a directory and generate the HTML for the images. The line breaks exist, but HTML doesn't render line breaks unless you specifically put a <br> element. You can use nl2br() to show line breaks in the text provided by users. You can't choose the size of a file, but you can give a size limit in the file uploader. There are plenty of PHP file upload tutorials, you should look at some of them. The W3Schools tutorial has sections explaining how to limit the file size and file type. You can use str_replace() to change substrings into something else, such as in the following example: <?php $string = str_replace(':)', '<img src="smiley.gif">', $string); ?>
  32. 1 like
    If they are child element of parent div, you need to add space before child elements. $( id + 'textarea') will look for an element with id '#letter_abstracttextarea' $( id + ' textarea') = '#letter_abstract textarea' will look for child textarea element whose parent element has this specific id.
  33. 1 like
    Also, you're never going to see a request in the network console because you're not sending the file over the network, everything is being done in the browser. You're reading the local file and updating the page, not sending it to a server. That's why there's no request to a server.
  34. 1 like
    IF you stringify the array you will simply get [ "AAAAAA" ] for single array value [ "AAAAAA","BBBBBB" ] for two array values, JSON.stringify(lsData) converts to ' [ "AAAAAA","BBBBBB" ] '. While when you use lsData = JSON.parse(localStorage.getItem("desSet"));it converts it back to a readable array of values with lsData[0] equallying "AAAAAA" and lsData[1] equallying "BBBBBB", that is what the loop does starting from 0 to less than total number of values (2) meaning 1.
  35. 1 like
    function lsCheck() { //Array to store Multiple values lsData = []; // if localstorage of desSet exists if (localStorage.desSet) { //get array stored in storage and apply to lsData, what was in storage is also in lsData now lsData = JSON.parse(localStorage.getItem("desSet")); //loop through array values creating elements for hold array content for (i = 0; i < lsData.length; i++) { var container = document.createElement("div"); container.className = "img_descrip_wrap"; //description var valDes = lsData[i] var des = document.createElement('p'); var tex = document.createTextNode(valDes); des.appendChild(tex); container.appendChild(des); document.body.appendChild(container); } } } //At the end of btn click function after appending new image and paragraph you have these values push into array (along with values from localstorage if exits which would have been populated by onload function) document.getElementById('btn').onclick = function() { //image var container = document.createElement("div"); container.className = "img_descrip_wrap"; //description var valDes = document.getElementById('idDes').value; var des = document.createElement('p'); var tex = document.createTextNode(valDes); des.appendChild(tex); container.appendChild(des); document.body.appendChild(container); // push (append) current value description input into array lsData.push(valDes); // apply the whole array to localstorage localStorage.setItem("desSet", JSON.stringify(lsData)); }; NOTE: this applies only to description value, and this has not been tested
  36. 1 like
    function myFunction(elem) { elem.nextElementSibling.classList.toggle("show"); var myDropdown = document.getElementsByClassName("dropdown-content"); for (var i = 0; i < myDropdown.length; i++) { if (myDropdown[i].classList.contains('show')) { if (elem.nextElementSibling !== myDropdown[i]) { myDropdown[i].classList.remove('show'); } } } } BUT! you do realise, the window onclick example (https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_js_dropdown) does not work in MS Edge, its so good of w3schools to give you an example that does not work in MS Edge and not tell you.
  37. 1 like
    Sure, you can do all of the layout math yourself that the browser would normally do when it positions elements. You can decide how large you want each thing to be, how much spacing between them, how large the canvas is, etc, and figure out the coordinates to draw everything. If you want to lay out everything yourself on a canvas then you can do that, you just need to do all of the math that the browser would normally do for you. If you want a border around the image and caption, for example, then you need to decide how thick the border is and account for that space, any space between the border and the inner contents, etc. The same thing goes for text, if you want the text to wrap to the next line then it's your responsibility to figure out how many pixels long the text is and where to wrap it, there's a description about that here. When you draw on a canvas you're not using CSS to position things on the canvas and then having the browser lay it all out, you're doing all of that manually and just telling the browser the coordinates to draw everything. Anyway, that's why I was wondering why you're using a canvas instead of just creating the div and img tags and adding them to the document, where the browser will handle layout, position, wrapping, etc.
  38. 1 like
    You should have the PHP run first, then the HTML. Here's the general structure of my PHP applications: <?php // Form handling logic if(isset($_POST['submit')) { // If submission was successful // Do something header('Location: http://www.example.com/target.php'); exit; } // Set variables for use in templates $template = 5; // Include a template file include 'template.php'; ?>
  39. 1 like
    header > h1, header > p{ color:red; } /*OR*/ header > h1, header > h1 + p{ color:red; } /*Give header class name */ .colour_version01 {color:red;} <header class="colour_version01"> <h1>Some text</h1> <p>Some more text</p> </header>
  40. 1 like
    That would be fine if you were coding for a website, but HTML emails need to be simple. if you want it random, you'll have to create several different images with the pictures in different orders.
  41. 1 like
    An id reference must be unique within a page, only class names can be used multiple times, so you would have to loop through classnames and make changes to next sibling img src attribute.
  42. 1 like
    Using jquery, - $('*').removeAttr('style'); or - $('span, div, ...').removeAttr('style'); // Specify the list of tag names for which style attribute to be removed.
  43. 1 like
    Had to make slight change, correct invalid html, which you should validate at https://validator.w3.org/ before posting <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0" /> <title>Document Title</title> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <style type="text/css"> #mydropdown option:hover { background: #c8c8c8; } #mydropdown option { padding: 5px; } .mydivs1 { display: none; } br { display: block; content: ""; margin-top: 5px; } .mydivs1 { border: 1px solid black; padding: 5px; height: 211px; width: 172px; margin-left: 5px; background-color: #ff8080; } .mydivs2 { border: 1px solid black; padding: 5px; height: 199px; width: 35px; float: left; background-color: #b3e6b3; } .mydivs3 { border: 1px solid black; height: 199px; width: 103px; margin-left: 52px; padding-left: 10px; padding-right: 5px; padding-top: 5px; padding-bottom: 5px; background-color: #cce6ff; } </style> </head> <body> <input type="text" id="mytextbox" placeholder="Search Foods"> <p></p> <select id="mydropdown" multiple="multiple"> <option value="optionx_Fruits">Fruits</option> <option value="optionx_Vegetables">Vegetables</option> <option value="optionx_Nuts">Nuts</option> <option value="optionx_Meats">Meats</option> </select> <p></p> Results: <p></p> <div id="results"> <div class="mydivs1" id="optionx_Fruits"> <!--match="optionx Fruits"--> <div class="mydivs2"> <button class="button1">X</button> <p style="clear:both"></p> <button class="button2">C</button> </div> <div class="mydivs3"> <span class="myspan1">Fruits</span> <p></p> <span class="myspan2">1:</span> <br> <span class="myspan3">Avocados</span> <p></p> <span class="myspan2">2:</span> <br> <span class="myspan3">Blackberries</span> <p></p> <span class="myspan2">3:</span> <BR> <span class="myspan3">Raspberries</span> </div> <p></p> </div> <p></p> <div class="mydivs1" id="optionx_Vegetables"> <!--match="optionx Vegetables"--> <div class="mydivs2"> <button class="button1">X</button> <p style="clear:both"></p> <button class="button2">C</button> </div> <div class="mydivs3"> <span class="myspan1">Vegetables</span> <p></p> <span class="myspan2">1:</span> <br> <span class="myspan3">Beets</span> <p></p> <span class="myspan2">2:</span> <br> <span class="myspan3">Eggplants</span> <p></p> <span class="myspan2">3:</span> <BR> <span class="myspan3">Spinach</span> </div> <p></p> </div> <p></p> <div class="mydivs1" id="optionx_Nuts"> <!--match="optionx Nuts"--> <div class="mydivs2"> <button class="button1">X</button> <p style="clear:both"></p> <button class="button2">C</button> </div> <div class="mydivs3"> <span class="myspan1">Nuts</span> <p></p> <span class="myspan2">1:</span> <br> <span class="myspan3">Almonds</span> <p></p> <span class="myspan2">2:</span> <br> <span class="myspan3">Pecans</span> <p></p> <span class="myspan2">3:</span> <BR> <span class="myspan3">Walnuts</span> </div> <p></p> </div> <p></p> <div class="mydivs1" id="optionx_Meats"><!--match="optionx Meats"--> <div class="mydivs2"> <button class="button1">X</button> <p style="clear:both"></p> <button class="button2">C</button> </div> <div class="mydivs3"> <span class="myspan1">Meats</span> <p></p> <span class="myspan2">1:</span> <br> <span class="myspan3">Chicken</span> <p></p> <span class="myspan2">2:</span> <br> <span class="myspan3">Fish</span> <p></p> <span class="myspan2">3:</span> <BR> <span class="myspan3">Turkey</span> </div> <p></p> </div> </div> <p></p> <!-- Original script --> <script type="text/javascript"> /* jQuery.fn.filterByText = function(mytextbox) { return this.each(function() { var select = this; var options = []; $(mydropdown).find('option').each(function() { options.push({ value: $(this).val(), text: $(this).text() }); }); $(mydropdown).data('options', options); $(mytextbox).bind('change keyup', function() { var options = $(mydropdown).empty().data('options'); var search = $.trim($(this).val().replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")); var regex = new RegExp(search, "gi"); $.each(options, function(i) { var option = options[i]; if (option.text.match(regex) !== null) { $(mydropdown).append( $('<option>').text(option.text).val(option.value) ); } }); }); }); }; $(function() { $('#mydropdown').filterByText($('#mytextbox'), true); });*/ /* $(document).ready(function() { function exists(elemt, arr) { return (jQuery.inArray(elemt, arr) > -1); } $('#mydropdown').change(function() { var $selected = $(this).val(); $('.mydivs1').each(function() { $(this).toggle()[ (exists($(this).attr('match'), $selected)) ? 'show' : 'hide'](); }); }); });*/ </script> <!--NEW Script --> <script> var SelOrderArray = []; $('#mydropdown').on('change keyup', function() { $('.mydivs1').hide(); var $selected = $(this).val(); if ($selected.length > 0) { $.each($selected, function(i) { //loop through selected possible multiple selected options if (SelOrderArray.indexOf($selected[i]) === -1) { //if current looped through $selected value not in array then add to array SelOrderArray.push($selected[i]); } }); } else { SelOrderArray.push($selected[i]); } // loop through ordered array of slected options $.each(SelOrderArray, function(i) { //clone element with specific id to temp storage variable var TmpDivClone = $("#" + SelOrderArray[i]).clone(); //remove current existing element with specific id $("#" + SelOrderArray[i]).remove(); // prepend temp cloned element to div #result wrapping mydiv1 elements so prepending remains below dropdown and show TmpDivClone.prependTo('#results').show(); }); }); </script> </body> </html>
  44. 1 like
    There are three aspects to take into account in a web page: Content: HTML Presentation: CSS Behavior: Javascript The same way we want to separate content from presentation, we also want to separate content from behavior. Javascript should only be inside <script> elements, CSS should only be in <style> or <link> elements and HTML should not be polluted with attributes concerning behavior and presentation. You wouldn't use align and bgcolor attributes, so why would you use onclick attributes? In your original code, otherTongue is restricted to the local scope of the function it was declared in, it's not accessible from outside. That's why the onchange event attribute can't find it, the event attribute is looking for a global function.
  45. 1 like
  46. 1 like
    Every time you create a new row you're adding another event handler to all the rows. The newest row will have just one event handler, but the older rows will have as many event handlers as times you've clicked the "new" button.
  47. 1 like
    If you want to use a database as the data store then that's one route to take, but if the data is static then you could get away with a CSV file or something. You wouldn't even necessarily need to use a server-side language like PHP to build the table (although you could), you could just send an ajax request in Javascript to get the CSV file and parse it in Javascript and go through it to build the table dynamically. Once the table is built and on the page then you'll probably just want to use a jQuery plugin or something for sorting and filtering.
  48. 1 like
    var acc = document.getElementsByClassName("accordion"); for (var i = 0; i < acc.length; i++) { acc.addEventListener("click", accordion); } function accordion() { for (var i = 0; i < acc.length; i++) { // Reset all of the elements but current selected if (acc.item(i) !== this) { acc.classList.remove("active"); acc.nextElementSibling.style.maxHeight = null; } } //check if current selected has 'active' class and remove it and next sibling, else add and show next sibling if (this.className.indexOf('active') !== -1) { this.classList.remove("active"); this.nextElementSibling.style.maxHeight = null; } else { // being a new selection and not a currently active selection add active class // Toggle the "active" class for the current item this.classList.add("active"); // Make the contents visible var panel = this.nextElementSibling; panel.style.maxHeight = panel.scrollHeight + 'px'; } }
  49. 1 like
    Add 'this' to the function called by anchor link event onclick <a onclick="myAccFunc(this)" href="#">First group<i class="fa fa-caret-down"></i></a> Then you need to ref that specifically clicked element, transverse down to next sibling element and change that elements classname function myAccFunc(elem)//amended by dsonesuk { var x = elem.nextElementSibling;//amended by dsonesuk if (x.className.indexOf("w3-show") == -1) { x.className += " w3-show"; x.previousElementSibling.className += " w3-green"; } else { x.className = x.className.replace(" w3-show", ""); x.previousElementSibling.className = x.previousElementSibling.className.replace(" w3-green", ""); } }
  50. 1 like
    You should add Notepad++ to that list.