I have set the on-tap value of a div to open a modal which is defined in the page's controller. The div is part of an ng-repeat section. The modal function also accepts some variables passed to it by the div.
When the app is first started on my device (iPhone 6 running iOS 7), I have to tap the div three times before the modal will open. After that, it opens consistently when I tap. But when the app first starts, I have to tap the div 3 times.
There are no errors at all in the console. Once the modal does open, it works as expected.
Any advice?
Here's the code:
HTML
<div on-tap="doModal('{{embed.ID}}','reply','{{embed.oembed}}','{{embed.user}}');">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 72" width="100" height="50">
<path d="imagestuffhere"/>
</svg>
</div>
CONTROLLER
$scope.doModal = function(this_ID,modaltype,this_oembed,this_user) {
$scope.contact = {
name: this_ID,
info: modaltype,
oembed: this_oembed,
user: this_user
}
if (modaltype == 'repost') {
$scope.modaltempl = 'templates/repost-modal.html';
}
else if (modaltype == 'reply') {
$scope.modaltempl = 'templates/reply-modal.html';
}
else if (modaltype == 'like') {
$scope.modaltempl = 'templates/like-modal.html';
}
else {
$scope.modaltempl = 'templates/like-modal.html';
}
$ionicModal.fromTemplateUrl($scope.modaltempl, {
scope: $scope,
animation: 'slide-in-up'
}).then(function (modal) {
$scope.modal = modal;
$scope.modal.show();
console.log($scope.modaltempl);
});
};
$scope.closeModal = function() {
$scope.modal.hide();
};
$scope.$on('$destroy', function() {
$scope.modal.remove();
});
I've tried pulling the $ionicModal.fromTemplateUrl($scope.modaltempl, bit outside of $scope.doModal and calling $scope.modal.show from within $scope.doModal, but the result is the same.
It definitely gets to the scope.modal.show(); statement even when the modal does not open, because the console.log I've included just after it gets output.
Before I had added the svg to the interface, I was testing this using a button element and had the same issue. It also had the same issue when I used ng-click instead of on-tap.
Thanks for any help!
Turns out the issue was not in the Ionic controller code nor the triggering html, but in the modal template, itself.
Per the Ionic documentation, I had each of my modal templates wrapped in this:
<script type="text/ng-template" id="repost-modal.html"></script>
By removing that and replacing it with just <ion-modal-view></ion-modal-view> the issue was resolved and the modals now open very nicely on the first click.
Related
In my spec file, I am identifying a web element and then performing action like unpublish and then identifying the new status by verifying the button label as "Publish".
My Article_Spec file is as below,
//Article_spec//
'use strict';
var FunLib = require('/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/FFAutomation/Function_Lib.js');
var ArticlePO = require('/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/FFAutomation/Article_PO.js');
describe('News: ', function() {
var FuncLib;
var Article;
FuncLib = new FunLib();
Article = new ArticlePO();
//scenario 1: Navigate to News Menu
it('Navigate to News menu', function() {
browser.ignoreSynchronization = true;
FuncLib.SelectMenu.get(0).click(); //Click on News Menu
console.log('Article menu is clicked.');
browser.sleep(3500);
expect(FuncLib.SelectSubMenu.getText()).toEqual(["News", "Partners", "My News", "New article"]); // Verify the Submenus: News, Partners, My News, New article are present
});
//scenario 15: Verify published news can be unpublished
it('Verify published news can be unpublished', function() {
FuncLib.SelectSubMenu.get(2).click(); // Click on "New article" submenu
console.log('My News submenu is clicked.');
browser.sleep(7000);
Article.MyArticle.isDisplayed().then(function(result1) {
console.log(result1);
if (result1){
Article.MyArticle.click();
Article.Unpublish.isDisplayed().then(function(result2) {
if (result2) {
console.log('Published article is available');
Article.Unpublish.click();
Article.Publish.isDisplayed().then(function(result3) {
if (result3) {
console.log('Article unpublished successfully');
}
else {
console.log('Article is not unpublished.');
}
});
}
else {
console.log('Can not unpublish as all articles are unpublished.');
}
});
}
else {
console.log('No articles are available on My News screen');
}
});
});
My Article PO file is as below,
//Article Page object file - Article_PO.js
'use strict';
var ArticlePO = function(){
this.Title = element(by.model('article.title'));
this.Header = element(by.model('article.header'));
this.ImgFooter = element(by.model('article.cover_footer'));
this.ArtDsc = element.all(by.css('.ng-pristine.ng-untouched.ng-valid.ta-bind')).get(0);
this.KeyWrd = element(by.model('$mdChipsCtrl.chipBuffer'));
this.msg1 = "Title is missing";
this.msg2 = "Insert title, image, header and body before publishing your New.";
this.msg3 = "ARTICLE SAVED";
this.msg4 = "ERROR_UPLOADING_FILE";
this.MyArticle = element.all(by.css('.md-whiteframe-z2.controls.layout-column')).get(0);
//element.all(by.css('[ng-class="{ notint: !item.is_published }"]'));
this.PreviewTab = element.all(by.css('.md-fab.md-accent.md-mini.md-button.md-white-theme.md-ink-ripple')).first();
this.EditTab = element.all(by.css('.md-fab.md-accent.md-mini.center.md-button.md-white-theme.md-ink-ripple'));
this.Unpublish = element.all(by.buttonText("UNPUBLISH"));
this.Publish = element.all(by.buttonText("PUBLISH"));
this.deleteArt = element(by.css('[ng-click="deleteArticle($event, item)"]'));
this.LastArticle = element.all(by.css('[ng-class="{ notint: !item.is_published }"]')).last();
this.ConfirmDelete = element(by.css('.md-dialog-content'));
};
module.exports = ArticlePO;
Problem I am facing here is, even when my screen has multiple articles
Article.MyArticle.isDisplayed().then(function(result1) {
return as false. And so the output of this script is 'No articles are available on My News screen'.
Console output is as below,
Rohits-MacBook-Pro:FFAutomation rohitgathibandhe$ /Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/bin/protractor conf.js
Report destination: target/screenshots/Report.html
Using FirefoxDriver directly...
[launcher] Running 1 instances of WebDriver
Started
Browser title is: ForFirm
.When registred email Id and password is entered user logged in successfully
Logged in user is : Guglielmo Della Valle
.Article menu is clicked.
.My News submenu is clicked.
false
No articles are available on My News screen
4 specs, 0 failures
Finished in 131.21 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] firefox #01 passed
Closing report
Other details are as below: protractor#3.2.2, nodeVersion: 4.2.4, npmVersion: 2.14.12, jasmine: 2.4.1, selenium-webdriver: 2.52.0, firefox: 46.0.1
Please tell me what is going wrong here. I want to get correct result.
HTML code is added below for the object: first article
<div ng-class="{ notint: !item.is_published }" ng-if="item.manageable" class="manage overlay ng-scope layout-column flex"><div class="md-whiteframe-z2 controls layout-column"><div class="button-row layout-row"><div class="border-right flex"><a class="md-fab md-accent md-mini md-button md-white-theme md-ink-ripple" ng-transclude="" href="/article/view/378-test" md-theme="white"><ng-md-icon icon="visibility" size="20" class="ng-scope"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20"><path d="M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-12.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5z"></path><path d="M12 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path></svg></ng-md-icon></a></div><div class="border-right flex"><a class="md-fab md-accent md-mini center md-button md-white-theme md-ink-ripple" ng-transclude="" href="/article/edit/378" md-theme="white"><ng-md-icon icon="edit" size="20" class="ng-scope"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z"></path><path d="M20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg></ng-md-icon></a></div><div class="flex"><button class="md-fab md-accent md-mini right md-button md-white-theme md-ink-ripple" type="button" ng-transclude="" ng-click="deleteArticle($event, item)" md-theme="white"><ng-md-icon icon="delete" size="20" class="ng-scope"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12z"></path><path d="M19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></svg></ng-md-icon></button></div></div><button class="md-raised md-primary md-hue-2 md-button md-noga-theme md-ink-ripple" type="button" ng-transclude="" ng-click="togglePublish(item)" md-theme="noga" ng-show="item.is_published" aria-hidden="false"><span class="ng-binding ng-scope">UNPUBLISH</span></button><button class="md-raised md-primary md-hue-1 md-button md-ink-ripple ng-hide" type="button" ng-transclude="" ng-click="togglePublish(item)" ng-show="!item.is_published" aria-hidden="true"><span class="ng-binding ng-scope">PUBLISH</span></button></div></div>
First off, thanks for providing the entire test, the console output, the page objects, and the html. Very helpful!
One problem is that the console logging message are not displaying within the context of the control flow. That is, the messages may be appearing BEFORE the test even starts running, because the protractor actions are deferred as asynchronous calls while the console.log happens immediately. To fix that, put console.log message inside the deferred statements like this:
//scenario 1: Navigate to News Menu
it('Navigate to News menu', function() {
browser.ignoreSynchronization = true;
//Click on News Menu
FuncLib.SelectMenu.get(0).click().then(function() {
// put console.log HERE so that it executes at the right time
console.log('Article menu is clicked.');
});
browser.sleep(3500).then(function() {
console.log('slept for 3500ms');
});
expect(FuncLib.SelectSubMenu.getText()).toEqual(["News", "Partners", "My News", "New article"]); // Verify the Submenus: News, Partners, My News, New article are present
});
//scenario 15: Verify published news can be unpublished
it('Verify published news can be unpublished', function() {
// Click on "New article" submenu
FuncLib.SelectSubMenu.get(2).click().then(function() {
console.log('My News submenu is clicked.');
});
browser.sleep(7000).then(function() {
console.log('slept for 7000ms');
});
Article.MyArticle.isDisplayed().then(function(articleIsDisplayed) {
console.log('articleIsDisplayed: ' + articleIsDisplayed);
if (articleIsDisplayed){
Article.MyArticle.click();
Article.Unpublish.isDisplayed().then(function(unpublishIsDisplayed) {
if (unpublishIsDisplayed) {
console.log('Published article is available');
Article.Unpublish.click();
Article.Publish.isDisplayed().then(function(publishIsDisplayed) {
if (publishIsDisplayed) {
console.log('Article unpublished successfully');
}
else {
console.log('Article is not unpublished.');
}
});
}
else {
console.log('Can not unpublish as all articles are unpublished.');
}
});
}
else {
console.log('No articles are available on My News screen');
}
});
});
Another problem is browser.ignoreSynchronization = true in the first test, but not in the second test. If the page is angular, you shouldn't need to ignore synchronization (and you won't need all the browser.sleep commands). If you do need it, however, it should be in both tests, or in the beforeEach.
Since the isDisplayed promise looks right, it could be a problem with the timing (maybe takes more than 7 seconds to appear after the click?), or that the selector is wrong, or that the pageObject implementation isn't quite doing the right thing.
In your test, try replacing Article.MyArticle.isDisplayed() with element(by.css('.md-whiteframe-z2.controls.layout-column')).isDisplayed() to try finding the element without using the pageObject. If that works, then try changing it to element.all(...).get(0).isDisplayed() in the test. If it is able to find the element that way, then we could work on updating the pageObjects.
browser.waitForAngular().then(function(){
#your code here
return this;
}
Maybe element is not loaded and u have to wait for it to appear.
I Stand corrected! using first() and get(0) in your case is same. The issue here i think is calling the element in page object before the tests are executed as in -
this.MyArticle = element.all(by.css('.md-whiteframe-z2.controls.layout-column')).get(0);
The above code tries to access the element in the page object only and when try to use this in tests it is not working.
In Page Objects one should only define the Elements:
this.MyArticle = element.all(by.css('.md-whiteframe-z2.controls.layout-column'));
And then perform some actions to that element in the tests :
Article.MyArticle.get(0).isDisplayed().then(function(result1) {
console.log(result1);
if (result1){
Article.MyArticle.click();
This should certainly work and Upvoting Martin's answer as he has also specified this.
Here is my code..If I remove close modal function,there is no effect. If I click any where outside the modal, the modal closes. But I need this close modal function as I need to set a flag in it for further use. How can I proceed further?
$scope.$on('$ionicView.afterEnter', function() {
$scope.openModal();
}
$ionicModal.fromTemplateUrl("settings/settingsModal.html", {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
});
$scope.openModal = function(){
$scope.modal.show();
}
$scope.closeModal = function(){
$scope.modal.hide();
};
}
There are a two ways of implementing modal in Ionic. One way is to add separate template and the other is to add it on top of the regular HTML file, inside script tags. First thing we need to do is to connect our modal to our controller using angular dependency injection. Then we need to create modal. We will pass in scope and add animation to our modal.
After that we are creating functions for opening, closing, destroying modal and the last two functions are place where we can write code that will be triggered if modal is hidden or removed. If you don't want to trigger any functionality when modal is removed or hidden you can delete the last two functions.
Controller's Code:
.controller('MyController', function($scope, $ionicModal) {
$ionicModal.fromTemplateUrl('my-modal.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
});
$scope.openModal = function() {
$scope.modal.show();
};
$scope.closeModal = function() {
$scope.modal.hide();
};
//Cleanup the modal when we're done with it!
$scope.$on('$destroy', function() {
$scope.modal.remove();
});
// Execute action on hide modal
$scope.$on('modal.hidden', function() {
// Execute action
});
// Execute action on remove modal
$scope.$on('modal.removed', function() {
// Execute action
});
});
HTML Code :
<script id = "my-modal.html" type = "text/ng-template">
<ion-modal-view>
<ion-header-bar>
<h1 class = "title">Modal Title</h1>
</ion-header-bar>
<ion-content>
<button class = "button icon icon-left ion-ios-close-outline"
ng-click = "closeModal()">Close Modal</button>
</ion-content>
</ion-modal-view>
</script>
There are also other options for modal optimization. I already showed how to use scope and animation. The table below shows other options.
Modal options
The close modal function is meant for situations where you would like to close the modal manually. For example after a certain time it has been open or if something happens/the user does something for example presses a button.
There are ways of listening to when the modal is hidden/removed which will suit your situation and needs. For example:
// Execute action on hide modal
$scope.$on('modal.hidden', function() {
// Execute action
console.log('modal was hidden');
});
// Execute action on remove modal
$scope.$on('modal.removed', function() {
// Execute action
console.log('modal was removed');
});
With these you should be able to do what I understood you are wanting to do.
Straight from the documentation: http://ionicframework.com/docs/api/service/$ionicModal/
I have trouble with updating a $scope object when It's inside a Modal.
$scope.lists = {};
$ionicModal.fromTemplateUrl('foobar-show.html', function($ionicModal) {
$scope.modal = $ionicModal;
}, {
scope: $scope
});
As you can see it's the normal $ionicModal
And it opens the Modal with this: <a ng-click="doOpen()">Modal</a>
$scope.doOpen = function(){
$scope.modal.show();
$scope.foobar = {};
};
Inside I do a {{ lists.length }} > returns 0
But then I'm calling inside that Modal the function:
$scope.fooAction = function(a){
$scope.lists.push(a);
alert($scope.lists.length);
};
The alert returns a +1. So 1 after the first time, but the View of the modal still returns 0... Is it a different scope or something? I pass it with the ionicModal, right? How to fix this?
Beacause the modal is created the first you enter the view and than is being cached, you have to tell your view not to cache it.
<ion-view cache-view="false">
I am able to do this using an ID prefix as the selector, but I need to be able to do it with classes instead. It's an each function for opening up different modal windows on the same page. I need to avoid using ID names because I have some modal windows that will have multiple links on the same page, and when using IDs, only the first link will work.
So here's the function as it works with IDs:
$('div[id^=ssfamodal-help-]').each(function() {
var sfx = this.id,
mdl = $(this),
lnk = $('.link-' + sfx),
cls = $('.ssfamodal-close'),
con = $('.ssfamodal-content');
lnk.click(function(){
mdl.show();
});
cls.click(function(){
mdl.hide();
});
mdl.click(function() {
mdl.hide();
});
con.click(function() {
return false;
});
});
and I'm trying to change it to classes instead, like:
$('div[class^=ssfamodal-help-]').each(function() {
var sfx = this.attr('class'),
etc.
But I cannot get it to work without using IDs. Is it possible?
EDIT Fixed error with semi-colon at end of Vars, and updated Fiddle with the fix. Still not working though.
Here's a Fiddle
** UPDATE **
To be clearer, I need to be able to refer to the same modal more than once on the same page. E.g.:
MODAL 1
MODAL 2
MODAL 3
MODAL 4
LINK TO MODAL 1
LINK TO MODAL 2
LINK TO MODAL 3
LINK TO MODAL 4
OTHER STUFF
LINK TO MODAL 1
LINK TO MODAL 4
LINK TO MODAL 3
OTHER STUFF
LINK TO MODAL 2
ETC.
When using classes get rid of the ID habit :
className1, className2, className3 ... etc
simply use
className
HTML:
<div class="ssfamodal-help-base ssfamodal-backdrop">
<div id="help-content" class="ssfamodal-content">
<span class="ssfamodal-close">[x]</span>
Howdy
</div>
</div>
<div class="ssfamodal-help-base ssfamodal-backdrop">
<div id="help-content" class="ssfamodal-content">
<span class="ssfamodal-close">[x]</span>
Howdy Ho
</div>
</div>
<span class="link-ssfamodal-help-base">One</span>
<span class="link-ssfamodal-help-base">Two</span>
LIVE DEMO
var $btn = $('.link-ssfamodal-help-base'),
$mod = $('.ssfamodal-help-base'),
$X = $('.ssfamodal-close');
$btn.click(function(i) {
var i = $('[class^="link-"]').index(this); // all .link-** but get the index of this!
// Why that?! cause if you only do:
// var i = $('.link-ssfamodal-help-base').index();
// you'll get // 2
// cause that element, inside a parent is the 3rd element
// but retargeting it's index using $('className').index(this);
// you'll get the correct index for that class name!
$('.ssfamodal-help-base').eq(i).show() // Show the referenced element by .eq()
.siblings('.ssfamodal-help-base').hide(); // hide all other elements (with same class)
});
$X.click(function(){
$(this).closest('.ssfamodal-help-base').hide();
});
From the DOCS:
http://api.jquery.com/eq/
http://api.jquery.com/index/
http://api.jquery.com/closest/
Here I created a quite basic example on how you can create a jQuery plugin of your own to handle modals: http://jsbin.com/ulUPIje/1/edit
feel free to use and abuse.
The problem is that class attributes can consist of many classes, rather than IDs which only have one value. One solution, which isn't exactly clean, but seems to work is the following.
$('div').filter(function () {
var classes = $(this).attr('class').split(/\s+/);
for (var i = 0; i < classes.length; i++)
if (classes[i].indexOf('ssfamodal-help-') == 0)
return true;
return false;
}).each(function() {
// code
});
jsFiddle
Or, equivalently
$('div').filter(function () {
return $(this).attr('class').split(/\s+/).some(function (e) {
return e.indexOf('ssfamodal-help-') == 0;
});
}).each(function() {
// code
});
jsFiddle
If there is one-to-one relationship between the modal helps and the modal links which it appears there is...can simplfy needing to match class values by using indexing.
For this reason you don't need unique class names, rather they just overcomplicate things. Following assumes classes stay unique however
var $helps=$('div[id^=ssfamodal-help-]');
var $help_links=$('div[id^=link-ssfamodal-help-]');
$help_links.click(function(){
var linkIndex= $help_links.index(this);
$helps.hide().eq( linkIndex ).show();
});
/* not sure if this is what's wanted, but appeared original code had it*/
$helps.click(function(){
$(this).hide()
})
/* close buttons using traverse*/
$('.ssfamodal-close').click(function(){
$(this).closest('div[id^=ssfamodal-help-]' ).hide();
});
Also believe that this code is a little more readable than original apporach
DEMO
Can you try this,
$('div[class^=ssfamodal-help-]').each(function() {
var sfx = $(this).attr('class');
console.log(sfx);
/*console log:
ssfamodal-help-base ssfamodal-backdrop
ssfamodal-help-base2 ssfamodal-backdrop
*/
});
Demo: http://jsfiddle.net/xAssR/51/
why don't you write like
$('div.classname').each(function() {
// you can write your desired code here
var sfx = this.attr('class');
var aa= this.attr('id');
});
or
$('.classname').each(function() {
// you can write your desired code here
var sfx = this.attr('class');
var aa= this.attr('id');
});
where classname is the name of the class used for the div in html
Thanks.
I'm struggling with plugging in the correct selector into jquery. When I plug in ".accordionButton" the entire div is clickable and the functionality works great. However, I want to make only the "h3.toggle a" clickable, but plugging that selector in doesn't work. Is there something else in the jquery I need to change here? Any advice is greatly appreciated. Thanks!
The HTML:
<div class="accordionButton">
<div class="case-top">
<div class="case-left"></div>
<div class="case-right">
<h3 class="toggle">Our Strategy and Results</h3>
</div>
</div><!--end case-top-->
</div><!--end button-->
<div class="accordionContent">sliding content here</div>
The JQUERY:
$(document).ready(function() {
//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
$('.accordionButton h3.toggle a').click(function() {
//REMOVE THE ON CLASS FROM ALL BUTTONS
$('.accordionButton h3.toggle a').removeClass('on');
//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
$('.accordionContent').slideUp('normal');
//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
if($(this).next().is(':hidden') == true) {
//ADD THE ON CLASS TO THE BUTTON
$(this).addClass('on');
//OPEN THE SLIDE
$(this).next().slideDown('normal');
}
});
/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER
$('.accordionButton h3.toggle a').mouseover(function() {
$(this).addClass('over');
//ON MOUSEOUT REMOVE THE OVER CLASS
}).mouseout(function() {
$(this).removeClass('over');
});
$('.accordionContent').hide();
});
You are using
$(this)
but you change the selector, you need to change all $(this) selectors to
$('.accordionButton')
FIDDLE
Ok, here is where I'm at... the buttons are now working correctly, but on click all the instances of .accordionContent open, not just next one. ( FYI, I removed the mouseover from this code snipped)
Jquery
$(document).ready(function() {
//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
$('.accordionButton h3.toggle a').click(function() {
//REMOVE THE ON CLASS FROM ALL BUTTONS
$('.accordionButton h3.toggle a').removeClass('on');
//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
$('.accordionContent').slideUp('normal');
//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
if($('.accordionButton').next().is(':hidden') == true) {
//ADD THE ON CLASS TO THE BUTTON (correct)
$(this).addClass('on');
//OPEN THE SLIDE
$('.accordionButton').next().slideDown('normal');
}
});
I'm guessing the lines:
$('.accordionButton').next().slideDown('normal');
and
if($('.accordionButton').next().is(':hidden') == true) {
are the lines which need editing. I need these two lines to open and close just the "next" .accordionContent instances not all of the instances together.