Dynamically disabling / enabling the links in a Bootstrap dropdown menu on-click - javascript

I understand that bootstrap allows a user to disable links within its dropdown menu component simply by adding a class="disabled" into the corresponding <li> tag.
What I'd like to do is write some javascript so that when a user selects the dropdown menu and clicks on a link within it, that link will become disabled. It's in the nature of the dropdown menu to close immediately when a valid link is selected, or when the user clicks outside of the dropdown box. Therefore when the user opens the menu on any subsequent visit, he or she should see all of their previously selected items appearing as disabled.
I've already tried to use the solutions posted in this link: disable a hyperlink using jQuery, but none of them are working for me.

Using Nagra's above javascript solution in this modified form: $('#my_link').click(function(){$(this).addClass('disabled');}); I am able to add the disabled class to each of the <li> elements whenever a user clicks on the <a> embedded within the <li> parent.
Thank you.

Related

Oracle APEX - Put onclick event on tabs of tabs container

I've got a tabs container with three tabs. They have select lists and checkboxes on them which have sql queries as source. Users can select entries in the lists or edit the checked boxes and save this to the database by clicking a button. This button also re-fills the select lists and checkboxes with the current data from the database after saving it.
My problem is: When a user selects an entry in a select list or edits a check box and navigates to antoher tab without clicking on the "save" button, the data stays there when navigating back to the tab. I want to assure that what is depicted in the lists and check boxes is always the current data like it is in the tables in the database.
Therefore, I tried to put an onclick event on the tabs of the tabscontainer like this one:
I didn't get it to work, becuase these elements do not have an ID and I can not set an ID for them in APEX (at least I guess so). Is there a way to do this in APEX anyway?
This is one of the tab elements:
You can put a static ID to your tab region (for example #SOME_STATIC_ID) and then select the elements with a jQuery selector:
$("#SOME_STATIC_ID a.t-Tabs-link")
You could also define an on click listener on text of the tab:
$(".t-Tabs-label:contains('Tab 1')").click(function(){alert('Doing something on click of Tab 1 !!!')});
It might not be the cleanest solution but it works.
Just in case anyone else is experiencing the same problem: I solved it by putting an custom dynamic action on the tabs container:
This fires whenever the user switches between the tabs and ehrefore worked for me :-)
For more information check this article: https://medium.com/#pierre.yotti/tabs-region-javascript-api-in-oracle-apex-37e20bc9f68f

Clicking on a link hidden based on time

Well I am a newbie and i want to know that can I click on a link which is hidden and shows on a particular through JavaScript on console in Google chrome. I want to click on that link before the time it become visible. I noted its attribute tag when it becomes visible.
I want to click on below attribute tag which become visible on a particular time.
<a onclick="aplook(this,'01785','xxxx','xxx','10-12-2014','xx','xx',3);" id="refid2">Click Here </a>
The link first needs to load before an action can be perform on it.
You could use CSS to hide the link, and then use javascript to click on it.

Open html form below home page Onclick

I am using on click method onclick example am using
I am using two step Onclick method when I click 2nd Onclick a HTML form should open in same page how do I do that
since I am using many sub categories Like ,mobile, computer, etc,...
so I have many sub form
when user click sub form the linked form should open in same page here is the working example Onclick method
what I need is how to open html form file below
You could do something like this: http://jsfiddle.net/8ugjj2yo/2/
In short: bind click events on each 1:st menu item, and then on 2:nd menu item.
Each click handler should close "all other" of the same kind when you click it, then open whatever you clicked (if you want more forms to be displayed at the same time, remove all rows that call
.hide();
The css supplied in the fiddle is just temporary, change it to whatever, the only thing you can't change is the
display:none;
thats there already. (You could also hide them on page load with jquery ofc..)

Bootstrap menu is open when page is loaded

I've implemented into my website the Bootstrap dropdown menu and the issue is that when I load the page, then as the default statue is popped up dropdown menu. I am struggling with how to have this dropdown menu hidden when the page is loaded as default.
Here's the HTML structure:
Sign in
<div class="login_window dropdown-menu">
...
</div>
So, when I load the page, the window is displayed. When I click somewhere, then is hidden. When I click on it, then will be displayed again. That's ok.
But I am trying to have the window have hidden when I load the page. How to achieve that?
Thanks
add display:none in default css for the class you want to hide...then in jquery do
$("body").click(function(){
$('.divclass').css('display','block'); /*or $('.divclass').toggle() */
})
My guess is that you have the structure of your HTML wrong. Did you look at the example on bootstrap? http://getbootstrap.com/components/#dropdowns
You need to have a clickable element (button, div, span - whatever) that's never hidden. When you click that element it animates the visibility of a sibling or child element to show the menu items. Try using the code from the sample and simply replace the <li> values with your menu items. That should help you understand the required form.
There is no need to toggle visibility on your own.

ASP.NET/Javascript hyperlink popup menu upon left click

I need to display a mobile-phone compatible popup menu when user left-clicks a HyperLink control. A menu will contain various options for this link, so its handler had to be aware of the clicked link data (actually, each link corresponds to a nickname).
What do I need to make that work?:)
Here are some links with pop menou.
http://www.php-development.ru/javascripts/dropdown.php
http://www.dynamicdrive.com/dynamicindex1/index.html
http://www.1stwebdesigner.com/resources/38-jquery-and-css-drop-down-multi-level-menu-solutions/
I think that there are too many more to find on google.

Categories

Resources