jquery

Make jquery tabs remember selection

夙愿已清 提交于 2021-01-28 12:29:02
问题 I have this jquery code: <script type="text/javascript"> $(document).ready(function() { $(".tabLink").each(function(){ $(this).click(function(){ tabeId = $(this).attr('id'); $(".tabLink").removeClass("activeLink"); $(this).addClass("activeLink"); $(".tabcontent").addClass("hide"); $("#"+tabeId+"-1").removeClass("hide") return false; }); }); }); </script> and this HTML: <div class="tab-box"> <a href="javascript:;" class="tabLink activeLink" id="companyinfo">Company</a> <a href="javascript:;"

jQuery remove class on closest

家住魔仙堡 提交于 2021-01-28 12:24:01
问题 I'm trying to action a removeClass request using jQuery. Most of the below script is working fine except for the $(this).closest('.press-continue').removeClass('hidden'); part. I have posted the jQuery and HTML below. Any ideas what could be the problem? $(function () { $('.step2').on('click', '.btn-book', function (e) { $.ajax({ url: '/reserve/' + this.id, type: 'get', dataType: 'json', context: this, success: function (json) { if (json['success']) { $(this).addClass('btn-selected'); $('.btn

jQuery remove class on closest

旧时模样 提交于 2021-01-28 12:20:56
问题 I'm trying to action a removeClass request using jQuery. Most of the below script is working fine except for the $(this).closest('.press-continue').removeClass('hidden'); part. I have posted the jQuery and HTML below. Any ideas what could be the problem? $(function () { $('.step2').on('click', '.btn-book', function (e) { $.ajax({ url: '/reserve/' + this.id, type: 'get', dataType: 'json', context: this, success: function (json) { if (json['success']) { $(this).addClass('btn-selected'); $('.btn

Make jquery tabs remember selection

寵の児 提交于 2021-01-28 12:18:03
问题 I have this jquery code: <script type="text/javascript"> $(document).ready(function() { $(".tabLink").each(function(){ $(this).click(function(){ tabeId = $(this).attr('id'); $(".tabLink").removeClass("activeLink"); $(this).addClass("activeLink"); $(".tabcontent").addClass("hide"); $("#"+tabeId+"-1").removeClass("hide") return false; }); }); }); </script> and this HTML: <div class="tab-box"> <a href="javascript:;" class="tabLink activeLink" id="companyinfo">Company</a> <a href="javascript:;"

Showing a div only on mobile devices using jQuery

六月ゝ 毕业季﹏ 提交于 2021-01-28 12:14:47
问题 i have a phone number div.when it is clicked, it will trigger a call,so i want to display this div only on mobile devices.for that i have assigned display none to the div initially and i am trying to show the div on mobile devices using jQuery like below $(document).ready(function () { if($(window).width() <= 480) { $('#phone-number').show(); } }); But it doesn't work.i didn't know what is wrong with this ,please someone help me in this issue 回答1: Can you also put your code in $(window)

How to pass multiple variables through Ajax?

拥有回忆 提交于 2021-01-28 12:11:05
问题 Below is a ajax code for a comment box which calls php code on another page that inserts comment into comments table. This code works well but it was just a test. Now I want to add userto, userfrom, postid along with comment into comments table For which I will need to pass variables of userto, userfrom etc from index.php to addcomment.php. Can I pass them through this ajax code to addcomments.php? index.php <script type="text/javascript"> $(function() { $(".comment_button").click(function()

DataTable cannot click the button after pagination

本秂侑毒 提交于 2021-01-28 12:11:02
问题 I have done a datatable and custom it's data but when i click the button on the first column, it only works on the first page and cannot click on other forward pages. $('#tbl').DataTable( { responsive: true, data: data1, autoWidth: false, "order": [[ 7, "asc" ]], "iDisplayLength": 5, "pagingType": "full_numbers", "dom": '<"top">rt<"bottom"p><"clear">', "oLanguage": { "sEmptyTable": "Not Record" }, "columnDefs": [ { "visible": false, "targets": [ 6,7,8 ] } ], "columns": [ {},{"sClass": "dt

How can I change the css of a day cell by date?

故事扮演 提交于 2021-01-28 12:10:57
问题 In a dayClick event, I can change the CSS of the current cell using this as shown in the fullcalendar documentation. For example, I just have to do $(this).css('background-color', 'red'); Assuming I have a date stored as a moment, how can do the same thing outside of the dayClick event? 回答1: Have a look at dayRender() method. I know... There isn't that much documentation... Here is a working fiddle of how to change the background color of the current date and all the 7 days after current date

How to call a function by a variable name [duplicate]

天涯浪子 提交于 2021-01-28 12:10:55
问题 This question already has answers here : How to turn a String into a JavaScript function call? [duplicate] (13 answers) Closed 7 years ago . My question is sort of complex but I will try to word as best I can. I am making a website with that involves a lot of javascript. I don't have everything setup so some of the scripts aren't hooked up with anything. I want to make a popup console that will allow me to type in what function I want the computer to preform and have the computer do so. Can I

Javascript Rounded Corners for Images

别来无恙 提交于 2021-01-28 12:09:25
问题 I need to display images with rounded corner. Long time back I saw a website doing this using a javascript library that overlayed the rounded corner image over the normal image. Do we have any javascript library (preferably jQuery plugin) to do this directly to img tags rather than usijg image as background for a div? 回答1: You can apply CSS3 border-radius to img elements, but the results are a bit wonky. See for yourself: http://jsbin.com/exiha This explains why the overlay you’re talking