Bloquear caracteres de input
Olá! Preciso bloquear os caracteres: ' " \ e / de um input do tipo password. Como faço isso?
Loading iframe content when scrolling and preventing reloading of content
I'm loading an iframe on the page when a user scrolls down the page and hits 500px but the problem I came across is preventing the content from re-loading. Every time you hit the 500 mark, the content re-loads itself. Can anyone tell me how to load it once? jQuery(document).scroll(function () {
var y = jQuery(this).scrollTop();
if (y > 500) {
jQuery('#loadme').attr('src', '/my-content.html');} });
Changing value of TextArea
How do I call JQuery when typing into a textarea please $('textarea').on('input change', function(e) { alert(e.currentTarget.value); }); Doesn't' do anything. I just isn't being called Thanks
Replacing comma
How do you replace a comma when someone types into a text area field with , I have several fields wirth the same name in a form and after the form is posted I am splitting using a comma bu ttaht doesn't worjk if they have entered a comma in the input field. Thanks
Selecionar todos os checkbox de uma única div
Olá! Preciso selecionar todos os inputs do tipo checkbox que estão em uma div específica depois de clicar em um outro input "selecionar todos". Como faço isso?
Adding question text areas
I have a button for adding new textarea for questions. My code add the new 6text area alright. The problem is if you enter something into one of the text areas then click on the button to add a new textarea what you have typed into any previous text areas vanishes. I have tried savign the content and addign the values back but that doesn't work. It still vanishes. What do I do please? This is my code - thanks function add_question() { alert(row_count); row = row_count - 1
jquery validation additional method
hey guys, its been a while!...im trying to using socket in a validation method to check if an email exists with the following code: jQuery.validator.addMethod('email_address_exists', function(value, element) { socket.emit('email_address_exists', value, function (result) { if (result === true){ return false; } return true; }); }, 'Email address already exists'); the sockets callback returns the correct results, returning true
Addiing rows
I have function add_question() { alert(row_count); row = row_count - 1 $( "#row" + row).after( "<tr id='row" + row_count + "'><td style='width: 1%''><input name='B3' type='reset' value='Delete'></td><td style='width: 1%'><h3>Question</h3></td><td width='35%'><textarea cols='20' name='S1 rows='5' style='width: 100%; color: #000000; font-family: Arial; font-size: 10pt'></textarea></td></tr>"); alert("<tr id='row" + row_count + "'><td style='width: 1%''><input
Adding and removing row from table
<table border="0" width="100%" cellspacing="10" cellpadding="20"> <tr> <td width="100%" align="left" valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="4"> <tr> <td align="left" valign="top" style="width:
what is this error...
hi, what is this error please... (screenshot attached..) I think this is because I'm using a newer vesion of jQuery (3.6.0) I tried finding an older version, tried with 2.2.4, got same error.. with 3.6.0 I did install jquery-migrate-1.4.1, but still got same error.. (I assume you call 3.6.0, THEN this migrate thing, I mean in <head>?) thank you...
Why is .nxt not acting as a selector
https://jsfiddle.net/uvaok906/
Reorder table columns and save to LocalStorage
I manage to reorder table columns and save the sort order in local storage. I found a solution to do this. The problem is that this method only works for one table. But how can I store the sort order for more than one table? https://jsfiddle.net/cwvj2q4e/
“Changes you made may not be saved.”.
window.addEventListener('beforeunload', (event) => { if (window.performance.getEntriesByType("navigation")){ <?php if (isset($_SESSION['varOperator']) | isset($_SESSION['varPassword']) | isset($_SESSION['varUserLevel']) | isset($_SESSION['varExtension'])) { ?> if (document.getElementById('can_logout').value == "No") { alert(document.location.href)
passing data from success() method using session.setAttribute()
I using the $.ajax() method to call a java servlet. The call is successful and all data is being passed successfully from the servlet to the 'success()' method. As a next step, the success method brings up a 'results' web page with the following statement: window.location = "results.jsp"; I would like to pass data to the 'results.jsp' page by setting one or more session attributes in the success method, but I cannot figure out how to do this. Can anyone describe how to do this or point me to a solution.
Embed Youtube Video - Safari
I am using this code so that when the user clicks on the cover image, the image is hidden and the youtube video starts to play. This works fine in Chrome. However, in Safari when the user clicks on the image, all that appears is a white space and the video doesn't play. I believe this is a problem with Jquery? Many thanks. function youtubez_shortcode(){ $youlink = get_field('fl_tube'); if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i',
finding the correct selector with woocommerce
So I have this jquery snippet to change the font in an input text box on selecting a font <script> $(".wc-pao-addon-image-swatch-select").change(function() { alert($(this).val()); $('.input-text').css("font-family", $(this).val()); }); </script> but I don't think the selectors or targets are right and I am not seeing the wood for the trees This is the html (sorry it is long and typically woocommerce) <form class="cart" action="https://website/product/product name/" method="post" enctype="multipart/form-data">
A little problem with toggleClass
I'm having a little problem with toggle class here: https://jsfiddle.net/sxnk6jwr/13/ if you click 1 and 3, the first td cell's highlight will switch from orange to gray. I'd appreciate a little help to solve this issue, please. thanks. here is jquery: $(function(){ $('#btn1').on('click', function() { $('#tb1 td').slice(0, 3) .toggleClass('orange'); }); $('#btn2').on('click', function() { $('#tb1 td').slice(3, 6) .toggleClass('orange');
AJAX .get() method - success and error functions
My understanding of calling the AJAX .get() method and declaring both a "success" method and an "error" method tells jquery to call the "success" method on a successful call and "error" if the method fails. Yet, when I call .get() in my source javascript file, BOTH methods are called every time. Am I reading the documentation wrong. For documentation I was looking at: https://www.w3schools.com/jquery/ajax_ajax.asp Jim A.
jQuery for loop doesn't iterate
In my script: $(function() { var j; for (j = 1; j <= 3; j++) { $('#' + 'clickMe' + j).click(function() { $('#' + 'showMe' + j).toggle(); }); } }); In my HTML: <table><tr> <td><div id="clickMe1">100 cal tiles</div></td> <td><div id="clickMe2">200 cal tiles</div></td> <td><div id="clickMe3">300 cal tiles</div></td> <td><div id="clickMe4">400 cal tiles</div></td> </tr> </table> <div id="showMe1" style="display: none;">lorem ipsum</div> <div id="showMe2" style="display: none;">lorem ipsum</div>
Smooth scroll working AND not working
I have a page with two identical on-page links... one at the top of the page and one at the bottom of the page. Smooth scrolling works with the top link, but not the bottom link. Any ideas what I'm missing? Here's the fiddle link: http://jsfiddle.net/Codewalker/6or8pwjx/62/ And the code: <section class="section" id="head"> <div class="container"> <h2>CTA</h2> <div> Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy
Ajax post does not work on mobile
Hello, I am creating a filter for my website with ajax and it works correctly from the computer. But when I enter from any mobile (android, ios, etc) it does not show the results. The code I use is as follows: jQuery version: v3.3.1 <script> $(document).ready(function(){ filter_data(); function filter_data() { $('.filter_data').html('<div class="spinner-border" role="status"></div>'); var action = 'fetch_data'; var categoria = get_filter('categoria');
How to wrap a simple "https://......" string with <a href="https://.....">....</a>?
Assume a webpage contains Internet URLs as usual similar to "http://www.foobar.cm/sample.html" But some of them are NOT included in a wrapping <a href="https://.....>.....</a>" How can I (with jQuery) add this <a ...>....</a> tag? for all such https://...... strings? Of cause if the https://.... string is already wrapped no second <a> tag should be added.
Select first option
<select id="size" name="size" <?php if(empty($edit_item[0]->size)){ echo "disabled readonly"; } ?>> <option value="">--Select--</option> </select How do I select the first option using jquery $("#size").val($("#size option:first").val()); Isn't working $('[name="size"]').val(''); Doesn't either Nothing I have tried works Thanks
images upload/download speed
I have html page that enable the user to upload images to server and show them right after the upload. The upload goes pretty fast but when I set images src (right after the upload ends) to the uploaded images it takes some time. Is there a better/quicker way to upload images (more than one) and view them on the page right after the upload ? I thought about something like accumulate imagee to browser cache while uploading..., not sure if its possible.
Hiding text input placeholder that has two styles when input field is entered
I have a form with a placeholder that contains two styles. On keyup, the placeholder text will disappear, but how can I make it disappear when the user enters the text input field, either by tabbing into the field or by clicking into the field? Here's what I have. I included a Fiddle as well: <div class="container test"> <div class="row"> <div class="col-sm-12"> <div class="placeholder-above"></div> <div class="guitar-service-address"> <span class="placeholder-location"><span
How to prevent popup when moving mouse to north over the Firefox bookmark toolbar?
Lets start with a sample webpage (from a german newsmagazine): https://www.fool.de/2020/12/26/trotz-covid-19-impfstoff-warum-auch-2021-noch-ganz-im-zeichen-von-corona-stehen-koennte/ Immediately before and during loading of the web page leave the mouse INSIDE the (Firefox) browser window. Then after successful loading move the mouse to north over bookmark toolbar. As you can see a popup (inside the webpage and not as separate Windows window) appears. How can I prevent this popup? I tried $('.sandiego-c-canvas.Campaign__canvas').hide();
Close dialog box and maintain scroll position
When I close my dialog box it scrolls to the top. How can I close it and maintain the scroll position? $("#dialog-container").dialog({ title: "MyTitle", width: 'auto', height: 'auto', modal: true, open: function () { jQuery('.ui-widget-overlay').bind('click', function () { jQuery('#dialog-container').dialog('close'); }); }
How to find and replace "style=" and width="...." values in HTML code (NOT CSS stylesheet)?
Assume I have a code like <div ..... style=".... width: 780px;">...</div> <rect ...... width="780px" ....">...</rect> So the width values are NOT retrieved from separate CSS stylesheet (file) but are part of a HTML code. How can I identify these elements by jQuery and change/overwrite the values to e.g. a width of lets say 400px?
append() outside or prependTo().next() ?
Assume the following html code: <table class="foobar">...</table> <script>....</script> <script>....</script> <script>....</script> <p>.....</p> Now I want to insert some stuff AFTER table which can be identified by its class. The two methods I considered do not work: 1. $(".foobar").append("......"); appends something INSIDE the <table>...</table> element but I want it outside 2. $("......").prependTo($(".foobar").next()); does not work either. a pre-grouping of $(".foobar").next() in an enclosing
How to simplify <figure><picture><source><img> combination?
In recent months I experienced more and more webpages which embed pictures not as simple images any more but as a nested element combination with a code like: <div> <figure> <picture> <source>...</source> <source>....</source> </picture> </figure> </div> Have a look at the sample web page https://www.makeuseof.com/tag/3-ways-to-reset-the-forgotten-windows-administrator-password/ Right click in chapter 1 on the big picture and select "Inspect element" The nested code above results in further problems
Why dataType: "text" doesn't bypass cors like "jsonp"
Situation: With the script below to get text string from a small hardware device over wifi. The device is configured as a wifi AP & does not respond to browser request, it just updates its web data every second. I can see the data string with ip address in web page(refresh = new data) & a script tag will receive as valid data. <script type="text/javascript" src="http://192.168.4.1"> </script> The text string is structured as multi line JS variables & is valid json. Problem is I need to use type:
Can't get on-the-fly select box to work
If you look at source code produced in web developer tools you see the following, however, it is all in one long string. It never shows up on the screen. Don't know how to fix. Help. <h2>Pick A Database to Restore.</h2>
<form id='frm1' action='' method='post'> <select id='mySelect' name='DBase'> <option value=''>Select...</option> <option value='1'>2020Oct14-14:40:24_accounts.sql</option> <option value='2'>2020Oct16-09:36:26_accounts.sql</option> <option value='3'>2020Sep18-13:31:43_accounts.sql</option>
How to remove whitespace after/inside <div>?
Assume the following code: <div class="foobar"> "whitespace" <p>....</p> </div> "whitespace" is not the text but a whitespace as indicated in Firefox WebDeveloper. How can I get rid of every whitespace inside after a <div class=foobar"> and the first <p> with jQuery?
Shorter command for search innermost element which contains certain string?
<div class="one">.... .... <div class="two">.... ... <div class="three">..... <p> <strong> blah foobar other text </strong> .... </p> </div> ....</div> ....</div> I am searching for a shorter (!) way to delete (resp.refer to) the innermost, nested <div> element which contains directly or indirectly in (sub)child elements the string "foobar". It the sample above only <div> element with class="three" should be removed. Currently I am using the following command: $("div:contains('foobar')").eq(($("div:contains('foobar')").length)
How to assign an inline style attribute to an element?
Assume the following code: <div class="foobar">.....</div> with CSS: .foobar { background: blue !important; } Now when I assign a new color with a jQuery statement like $(".foobar").css({'background-color' : 'red'}); then the previous color is NOT overwritten since it has an "!important" flag. In order to overwrite it anyway I have to assign the new value as inline style just as if would have written <div class="foobar" style="background:red">.....</div> This coding has higher priority as "!important".
How to populate an input text field attribute
We have a form that includes the following checkbox: <input type="checkbox" name="status" id="fee" data-subscription=""> I'm trying to write a script that inserts a value into data-subscription. Here's what I have so far, but it's not populating the data-subscription value. if (globally == true) { $('input[name="status"]').attr("data-subscription","false") } else { $('input[name="status"]').attr("data-subscription","true") }
How to remove all following elements even on higher levels? nextAll() up to root?
Assume I identified a certain element. Now I want to remove ALL following elements. I can do this with $(".foobar"):nextAll().remove(); The problem is, that this removes only elements on the same hierarchy level (=brothers). Ok, I could go one step upwards: $(".foobar"):parent().nextAll().remove(); But maybe there a many (unknown) parents() of parents(). I want to get rid of all the stuff which follows the referred element regardless of the hierarchy level. How can I achieve this? Peter
replace <video> elements by <img> element?
This is the original source <video .....> .... </video> How can I replace all such <video> elements by a picture from remote server <img href="https://www.foobar.com/pics/mypic.png" ........</img> Peter
parseXML adding line break
Im' trying to do a similar thing like this: https://jsfiddle.net/xt420oj1/ The result ends up like this: <?xml version="1.0" encoding="utf-8"?><root><obj someAttr="100500">some text</obj></root> But what I really want is having line breaks like this: <?xml version="1.0" encoding="utf-8"?> <root> <obj someAttr="100500">some text</obj> </root> Is that achievable? If so, how can it be done?
Assign jQuery Element to Javascript variable?
Normally I would write a pure Javascript statement like: var pane = document.getElementsByClassName("myclassname222")[0]; But what if jQuery offers a shorter way of identification? How can I assign an element from jQuery to Javascript variable? The following does NOT work: var pane = $("td:contains('sometext inside element')"); How else? Peter
Next Page