jquery

Boolean(“false”) returns true.. any alternative?

一笑奈何 提交于 2021-02-05 09:35:10
问题 I am using jquery to write true and false strings to data- html attributes. However when I write false to one of the attributes, and then check it it false, it returns true. I also read online that it supposed to do that, which really makes no sense at all. Does anyone have an alternative? Any help would be really appreciated! (function() { // $(".opt-header").click(function () { $(document).on("click", ".opt-header", function() { console.log($(this).attr("data-is-panel-activated")); var is

current class removed when refreshing page

拟墨画扇 提交于 2021-02-05 09:34:29
问题 I have created a dynamic link list in one page... When a click is done on one link on that dynamic list i want to show to user that link is active, so i will add one class to the clicked link but that new class removed suddenly when page refreshing. I want to keep that class till user click another one link. How can i achieve? My code is given below : <style> .activearea { background: #3f7aa5 !important; } </style> <script> $(document).ready(function() { $('a.areamenu').click(function(){ $('a

How to change radio button to 'checked' when another is selected?

萝らか妹 提交于 2021-02-05 09:33:35
问题 I hope you guys can help me with this one. How can I have a radio button id="A" change it's attribute to 'checked' when radio button id="B" is selected? Radio buttons A and B are in different groups. Thanks! 回答1: <input type="radio" name="group1" id="A">Radio A <input type="radio" name="group2" id="B">Radio B <input type="radio" name="group2" id="C">Radio C $("input[type='radio'][name='group2']").change(function() { if ($('#B').is(':checked')) { $('#A').prop("checked", true); } else { $('#A')

current class removed when refreshing page

梦想与她 提交于 2021-02-05 09:33:29
问题 I have created a dynamic link list in one page... When a click is done on one link on that dynamic list i want to show to user that link is active, so i will add one class to the clicked link but that new class removed suddenly when page refreshing. I want to keep that class till user click another one link. How can i achieve? My code is given below : <style> .activearea { background: #3f7aa5 !important; } </style> <script> $(document).ready(function() { $('a.areamenu').click(function(){ $('a

Get title string from url within iframe using jQuery?

旧城冷巷雨未停 提交于 2021-02-05 09:30:31
问题 I wonder if it is possible to get the page title of an url within IFRAME. I tried to use jQuery $('#iframe').attr('title') but that doesn't work. Please help. Thanks. 回答1: I think this is what you're looking for: $(document).ready(function() { alert($('#iframe').contents().find("title").text()); }); That will return the page title that is located in the <title> tag of the iframe document that has the id "iframe". 回答2: I misread your question. $('title', frames[frameName].document).text(); 回答3

jQuery dropdown select event

倾然丶 夕夏残阳落幕 提交于 2021-02-05 09:30:29
问题 Is there a specific event for when a user selects an item in a dropdown box? I am creating a fairly large form that uses multiple dropdown boxes. On load all but the first are disabled, as the user selects the first option the options in the second box change using AJAX and I want to remove the attribute disabled. $('#site_id').on('change', function(event) { $('#access_type_id').removeAttr('disabled'); }); The trouble I am having is that .change() seems to be fired when the options in a

How can I build real time system in asp.net?

偶尔善良 提交于 2021-02-05 09:28:25
问题 I am building an asp.net application for a health care domain. I need to keep the page to reflect real time updates. One way is to refresh the page after every x minutes but it may increase the load if there is no update. Moreover doing like this may not get the exact real time data. I want to achieve the almost complete real time functionality. How it can be done in ASP.NET C#..? 回答1: Have a look at SignalR https://github.com/SignalR/SignalR and http://www.hanselman.com/blog

Group div elements by dynamic class

江枫思渺然 提交于 2021-02-05 09:26:15
问题 I have a day class dynamic: <div class="day day111">a</div> <div class="day day111">a</div> <div class="day day112">a</div> <div class="day day112">a</div> <div class="day day113">a</div> I'm trying to get this: <div class="group"> <div class="day day111">a</div> <div class="day day111">a</div> </div> <div class="group"> <div class="day day112">a</div> <div class="day day112">a</div> </div> <div class="group"> <div class="day day113">a</div> </div> I can only do this in javascript. I'm trying

Group div elements by dynamic class

此生再无相见时 提交于 2021-02-05 09:26:08
问题 I have a day class dynamic: <div class="day day111">a</div> <div class="day day111">a</div> <div class="day day112">a</div> <div class="day day112">a</div> <div class="day day113">a</div> I'm trying to get this: <div class="group"> <div class="day day111">a</div> <div class="day day111">a</div> </div> <div class="group"> <div class="day day112">a</div> <div class="day day112">a</div> </div> <div class="group"> <div class="day day113">a</div> </div> I can only do this in javascript. I'm trying

Cannot read property 'style' of null

北城以北 提交于 2021-02-05 09:25:08
问题 Hi I am trying to hide a div when the page loads and display/hide it when a checkbox is checked/unchecked. This is my code: <asp:CheckBox ID="cb1" runat="server" Text="CB" /> <div runat="server" id="div1" style="display:none"> </div> And here is the javascript: window.onload = function () { $('#cb1').change(function () { display('div1'); }) } function display(id) { var traget = document.getElementById(id); if (traget.style.display == "none") { traget.style.display = "block"; } else { traget