jquery

Make button respond to the Enter Key

你说的曾经没有我的故事 提交于 2021-01-29 18:36:10
问题 I have a button on my form, and when the button is clicked, it takes the value of a textbox and populates that value into a list. Usually, when someone hits the enter key on a form, then the form is submitted but I have written this to stop that behavior: $(document).on("keypress", "form", function(event) { return event.keyCode != 13; }); But, now I would like the functionality of the Enter key to be used for the purpose of the button on the form. As of now I have this code (based on the

using jquery how to trigger event continually after the given time intervel

血红的双手。 提交于 2021-01-29 18:31:20
问题 I need to update given selector continually after the given time intervel. this is my code using javascript. function current_time(){ var content = document.getElementById('time_div'); content.innerHTML = '<p> Time is : '+Date()+'</p>'; } var v = setInterval( 'current_time()', 1000); this is ok. but my question is using jquery can we do that ? I tried this way. it works only one time. how I trigger that event continually after the given time interval(without click event). $(document).ready

Cannot get realtime calculate result use javascript in foreach condition

流过昼夜 提交于 2021-01-29 18:30:14
问题 now im working laravel project for implementing real time calculate result using javascript. but the condition is, the real time calculate is inside in foreach() code. here is the case Background Yellow is <input> code Background Red is realtime calculate result by Javascript Realtime calculate have 2 way to implement : Get result "Total Each" for each row Get result "Grand Total" for each column from now. i just able to get "Grand Total" for column "Price in dollar" and Column "discount".

Jquery access functions from an $.each loop

故事扮演 提交于 2021-01-29 18:28:12
问题 I have a list of checkboxes and want to do something with all the names of the checkboxes. But I can't seem to access the HTML objects: $('.update').click(function(){ $('input[type=checkbox]:checked').each(function(i,elem){ console.log(elem); elem.hide(); }); }); This produces TypeError: elem.hide is not a function But the console.log(elem) shows: <input type="checkbox" name="TV"> How can I access each element? 回答1: You are accessing the DOM node directly by using elem . You need to pass it

How can I add text in my scroll to top button which already has an icon in it

99封情书 提交于 2021-01-29 18:18:54
问题 I'm totally new to this field so please help me out. I've tried almost everything but nothing seems to be working. Actually, I want to add some text in my scroll to top button, which has already been made and working perfectly and it has an icon in it. But I want to add some text with that icon. Here's a link what I want to do! Following is the code I have in js file: // Append Button $("body").append($("<a />") .addClass("scroll-to-top") .attr({ "href": "#", "id": "scrollToTop" }) .append( $

Add delay between 'for' loop iterations

折月煮酒 提交于 2021-01-29 18:10:43
问题 I'm trying to implement basic 60 sec counter(A p element with id counter ), that is triggered after a button( counter_start() ) is pressed.But I want delay of 1 sec between this and make sure this updates in browser window in real-time <script type="text/javascript"> function counter_start(){ x=0 for(i=0;i<60;i++){ x++; document.getElementById("counter").innerHTML=x; } } </script> P.S: There might be other simple methods of implementing a timer.But it's not about timer...actually I'm a

Custom JSON error response fails when no error

♀尐吖头ヾ 提交于 2021-01-29 18:00:28
问题 This is a new area for me. I've created custom JSON error outputs to alert users if they enter a name and/or an email which already exists. I'm trying to spit out the errors and then if no error exists, continue. Unfortunately I'm getting the following message in Firefox console: "Uncaught SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 2 column 1 of the JSON data." It's weird as I have 3 JSON error variations set up which are working (1 name, 2 email,3

jQuery toggle submenu

元气小坏坏 提交于 2021-01-29 17:57:29
问题 I need some help. I try to create a toggle submenu, using jQuery. However, submenu appears only for a few seconds and then disappears, when I click the parent li . Here is the code: <div class="menu"> <ul> <li class="parent"> <a href="">Hello</a> <ul class="submenu"> <li> <a href="">Hello</a> </li> <li> <a href="">Hello</a> </li> </ul> </li> <li class="parent"> <a href="">Hello</a> <ul class="submenu"> <li> <a href="">Hello</a> </li> <li> <a href="">Hello</a> </li> </ul> </li> </ul> </div>

Datatable custom delete column

扶醉桌前 提交于 2021-01-29 17:55:11
问题 I have datatable with multiple movies(rows), at the end of each row, there is custom column for delete. Here is my datatable: HTML <table id="moviesTable1" class="table table-striped table-bordered"> <thead> <tr> <th>Title</th> <th>Duration</th> <th>Distributor</th> <th>Origin country</th> <th>Year of production</th> <th></th> </tr> </thead> <tbody id="moviesTbody"> </tbody> </table> jquery (I also have add movie, getAll which works fine) var MoviesManager = { getAll : function() { $.get(

JQUERY/ AJAX Request not going through and conflicts

时光总嘲笑我的痴心妄想 提交于 2021-01-29 17:53:37
问题 I have included a contact form in my page. In the same page I have a script that gets prices depending on the value of a dropdown. Now when I try to submit the contact message I have a conflict with the script for prices. Basically it tries to run it and I have no clue why. Also the contact form when submitted never works...I just get a new page to open with URL..?message=blablabla Any idea what is going wrong? I am working on Laravel 4.2 and so the route you see redirects to my php function.