I have a bunch of filters done in HTML (and bootstrap, I believe)
<li>
Condition <i class="glyphicon glyphicon-chevron-down"></i>
<ul class="dropdown-menu">
<li>All</li>
<li>New</li>
<li>Used</li>
</ul>
</li>
Next to them I have an "Update button". I would like that when a filter is used, the option that you pick is somehow saved and sent along the next time you press Update. For example, in the form of a GET parameter &condition=new.
How can I do this?
Related
Here is the demo code:
<ul>
<li>All</li>
<li> ADVERTISING </li>
</ul>
suppose, advertise is selected and and goes inside it. Clicking on back button sends back to All tab selected, how to get advertise selected.
I tried following codes but doesn't work
Back
<button type="button" onclick="history.back();">Back</button>
You should send back the data-filter from the inside page to identify which tab needs to be selected.
If received .advertising data-filter then you need to add class is-checked to the respective <a> tag
Example
Inside page
Back
don't forget to update the filename mainPage.php to your file name
Main page
<?php
$dataFilter = $_GET['dataFilter'];
?>
<ul>
<li>All</li>
<li> ADVERTISING </li>
</ul>
I have a very weird query. Searched a lot online but couldnot find a correct solution.
<ul class="dropdown-menu">
<li><a ng-model="data" href="Pre.html" target="_blank">Pre</a></li>
<li>Post</li>
</ul>
I have a simple dropdown menu with Pre and Post as its list in the dropdown.
When user clicks Pre, pre.html page opens, when he clicks post, post.html page opens.
this is normal operation. Now i want to do this.
If user clicks on the hyperlink 'Pre', assuming $scope.data= fasle at the controller side, then Pre.html page should open once
if $scope.data = true, then instead of Pre.html, i want the hyperlink to open some other html. for e.g. block.html.
how to ensure that depending on the condition in controller, the particular html page should display.
<ul class="dropdown-menu">
<li><a ng-model="data" href="Pre.html OR Block.html" target="_blank">Pre</a></li>
<li>Post</li>
</ul>
As seen above href="Pre.html OR Block.html", means i want to show either of the two pages depending on the controller side data
You could use ngHref and write something like:
<a ng-href="{{ data ? 'Pre.html' : 'Block.html' }}" target="_blank">Pre or Block</a>
Why not have two different tags toggle able using ng-if based on the controller's value. You could do something like,
<li>
<a ng-if="data" ng-model="data" href="Block.html" target="_blank">Block</a>
<a ng-if="!data" ng-model="data" href="Pre.html" target="_blank">Pre</a>
</li>
<li>Post</li>
Then some logic in the controller to change from true to false.
I'm stuck on 'on click' action on new DOM elemets in JQuery. I have approximately the following html setup:
<ul class="dateList">
<li>
<a href='#' data-date="2016-01-01">
</li>
<li>
<a href='#' data-date="2016-01-02">
</li>
</ul>
<ul class="timeList">
<li>
<a href='#' data-time="00:00:00">
</li>
<li>
<a href='#' data-time="03:00:00">
</li>
</ul>
When the page loads, the time list is loaded for the first available date. If user clicks on a different date, the current time list items get removed and new items are generated from pre-loaded json.
If the user click on the time, it is supposed to show relevant information. And it does after the page is loaded, however, once the date gets changed and the new time list items are created the on click event stops working on new time items.
I've tried adding $('.timeList').find('li') and $('.timeList li').find('a') to the end of the function that generates the new time list items but it does not seem to work.
Any help will be appreciated!
you will need to reference a higher level selector, such as body which was created prior to the dynamic content addition
something like
$('body').on('click','.timeList li',function(){
// do stuff
})
I'm looking for the absolute simplest way to pass a data attribute along to a new page (non AJAX loading).
I've been messing around with a Wordpress theme all night trying to customize the gallery category filters. I want to do as little coding as possible in making my adjustments to a pre-existing layout, but the complicating factor here is that I have a single page which already has data attributes assigned to elements that can be filtered from links on the same page and I need to be able to load the page with data attributes already set for filtering from external links.
I'll try to make a visual for the scenario that might help (or not ?):
First page is already functioning:
<!---main-gallery_page.php--->
<header class="category-filters">
<ul class="list">
<li> Category Filter 1 </li>
<li> Category Filter 2 </li>
<li> Category Filter 3 </li>
</ul>
</header>
<div class="gallery-thumbs">
<!--- thumbnails with example-id data attributes are filtered, respectively: "generic-X" --->
</div>
Second page needs to manipulate the page above after loading it ^
<!---second-example_page.php--->
<div class="alternate-category-filters">
<ul class="list">
<li> Category Filter 1 </li>
<li> Category Filter 2 </li>
<li> Category Filter 3 </li>
</ul>
</div>
Obviously the second example is not going to function because the new page doesn't receive any instructions to filter the thumbnails, so it'll just load as-is.
Just want to be able to operate the category filter on page load as specified from an external (non-ajax) page. Any ideas on a simple method? I've been trying to see what I can do with php echoes and even stuffing the info into the hyperlink href value, but I couldn't get that to work. It would be ideal if I could do something like this:
<!---second-example_page.php--->
<div class="alternate-category-filters">
<ul class="list">
<li> Category Filter 1 </li>
<li> Category Filter 2 </li>
<li> Category Filter 3 </li>
</ul>
</div>
Help would be greatly appreciated, I've exhausted myself jumping around millions of topics that always seem to just miss explaining this particular scenario's solution.
You could poll a value in localStorage. Make the main page poll localStorage.category. (Using setTimeout for example). Then, once the second page loads and changes the value, the main page could see the change and act accordingly.
I am using MVC 5. I have created navigation drop down. This is my code:
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="menu">
Report
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li class="myselector">a </li>
<li>b </li>
</ul>
</li>
Now I have same controller but different actions for a and for b.
How to move to another page while click a and b. Is there any click event available?
I think it work with some js code, but you does not attach any js here. So, you need to add something to your html code for identify your links as different links.
Something like this
<li class="myselector action-show-a"><a>A</a></li>
<li class="myselector action-show-b"><a>B</a></li>
Then you need to select your elements using .myselector and add to them specified action according to .action-show-a and .action-show-b. For this purpose you need to add eventlistners to onclick actions.