FAQ Database Discussion Community


Accessing the value of variable that is changed in a change method outside of the change method?

javascript,function,variables,onchange
I tried asking this type of question before, but I don't understand if what I want to do is possible. When things change like when a select dropdown is changed or checkbox is checked or unchecked is it possible to put those values in a global variable so I could...

jQuery .change() doesn't react on select with 1 option

javascript,jquery,html,select,onchange
i have a problem with my jQuery script on select tags on my page. I have a select that shows different content according to the selected option. You can run the snippet to understand it... $('#gpm2, #gpm3, #gpm4, #gpm5, #gpm6').hide(); $('#gpm').change(function() { $('#gpm1, #gpm2, #gpm3, #gpm4, #gpm5, #gpm6').hide(); $('#gpm' +...

Change a selected value based on selection

javascript,php,select,save,onchange
Here is what I am trying to do: If the user select the "add new" option, I would like to add an text box and take the user input and save it into my post. This part is working. The while loop gives other options that already exist in my...

Using Excel VBA to select onchange value in JavaScript web

javascript,excel,vba,web,onchange
I am very new to VBA, I've been tried many times to use Excel VBA to select the value on a website, but it doesn't work. Below is the code I use. Actually I don't know how to get the elements since it has no "id" or "name" tag. Sub...

Javascript edit input value by addition

javascript,function,onchange,addition
So I have this checkbox : <input type="checkbox" id="extra-bathroom" name="extra-bathroom" value= "1" style="display: inline;" onchange="updatePrice();">Extra bathroom? Which calls my function fine. I am just working out how to update the value of the below input by addition (I know I can just change the value, but I want to do...

Get return value from html dropdown appended from html.append

javascript,jquery,html,drop-down-menu,onchange
I am trying to generate a dynamic dropdown on a mouse over event over an object. I accomplished it like so, canvas.on('mouse:move', function (e) { $('body').append("<div id='imageDialog' style='position: absolute; top: 0; left: 0'><select id='mySelect' onchange='copy();'><option value='wipro' >wipro</option><option value='Hcl' >Hcl</option><option value='krystal kones' >krystal kones</option></select></div>"); }); This functionality works fine. But there...

Changing the value of a variable after an event

javascript,variables,object,variable-scope,onchange
Right now in the below code the var selected doesn't change (it outputs the empty string i guess). I need you to help me change the selected variable so that the value should be the selected option all of the time (in the select element). I also want to be...

Input, onChange CopyIt

javascript,input,onchange
I have this: It is copying what I type in input1 to input2 and it strip spaces etc. But it only copies when I'm hovering over input 2, is there a possibility to copy while typing? input1 <input name="input1" type="text" id="input1" size="60" onchange = "copyItt()" /> input2 <input onclick="javascript:stripspaces(this)" onmouseover="javascript:stripspaces(this)"...

jQuery mobile radio button changed event always fires even if already checked

jquery,jquery-mobile,event-handling,radio-button,onchange
I'm using a radio button group containing two radio buttons to dynamically change the content of my page depending on which radio button is checked. The content should be updated, when the selected radio button changes. Therefor i added an event handler to the radio buttons. html: <fieldset data-role="controlgroup" data-type="horizontal"...

How to immediately know that data in textarea has changed?

javascript,jquery,onchange
I making a page with a textarea that user can change. What is the best way to know that user is done entering data in it and i can send contents of it? I have tried using jQuery .change() function, but i found it a bit unreliable, since it triggers...

Detect all the change events based on document

javascript,jquery,event-handling,onchange
I'm using PJAX, so my html content is from AJAX, which means my elements are dymanic, I couldn't use $('input').on('change') (unless I use it every time I got the new content from AJAX ) My idea is using $(document).on() so I can keep tracking the events, but how do I...

Prevent Addition input

javascript,events,input,onchange,keyboard-events
I want to stop taking input in the text field once 10 characters have been entered. What I have so far is not working: $(document).ready(function() { $('#comment').keypress(function(event){ if ($('#comment').val()).length == 10) { event.preventDefault(); } }); }); What am I missing?...

Javascript onchange event

javascript,onchange
Im trying to use Javascript to change the background color of a text input depending upon a value selected in a drop down box. I want the background color of "businessname" input to be changed to yellow if "Business" is selected from the dropdown. This is the HTML for the...

HTML canvas switch and error message

javascript,regex,html5,canvas,onchange
I have run into a little problem in my code. Take a look at it here on JSFiddle What I want to do is to get an error message if you type in a wrong value at size and color. I tried to make this work, but I can't seem...

Javascript .onchange?

javascript,html,random,onchange
I am currently trying to find out a way to automatically store the previous price of an item before it gets updated. For instance, if on my website I show the currency exchanges let it be USD to EURO and I only get the real time exhange price, how can...

select onchange local storage not working in firefox

javascript,firefox,local-storage,background-color,onchange
I found similar Question but answers were with Jquery or not working in this particular case. i have the following HTML code <html> <body onload="load()"> <div> <select id="colorlist" onchange="saveSelect()"> <option value="white">White</option> <option value="#E0C2FF">#E0C2FF</option> <option value="orange">Orange</option> <option value="purple">Purple</option> </select> </div> </body> </html> and the following javascript code which works in Chrome...

Issue on change jquery function

jquery,wordpress,onchange
I am facing very weird issue. I have a dropdown option <table class="variations"> <tr> <td> <select name="up_options"> <option value="" selected>Select Value</option> <option value="a">A</option> <option value="b">B</option> <option value="c">C</option> <option value="d">D</option> <option value="e">E</option> </select> </td> </tr> </table> and make a jquery function that alerts me the selected value but it did not...

How can I trigger a value change event in a subvi, that has a reference to the possible changing value?

event-handling,onchange,labview
I have a subvi that receives two references to paths as input. The subvi does its thing and changes the value of the second path, based on the first one. (it adds a folder of the user's choice) One can consider the first path reference to truly be an input...

OpenERP : Multiple module overriding onchange function

python,openerp,onchange,openerp-7,overriding
I need to override onchange_partner_id function present in sale.order but I'm working on a system that already have a module overriding this function. I tried to write my own onchange_partner_id with similar code : def onchange_partner_id(self, cr, uid, ids, part): res = super(sale_order, self).onchange_partner_id(cr, uid, ids, part) // doing some...

How to change multiple form elements via single select

html,forms,select,if-statement,onchange
I'm completely stumped at how I can change the opening tag to have 'method=post' if the second select option is chosen. I am using an Onchange for the form action, but can't figure out how to change the post method too. My latest attempt is with an IF statement as...

Handle event fired when selected drop down option is selected again

javascript,jquery,html5,onchange
I have a select element like this: <select name="select1" id="select1"> <option value="1">1</option> <option value="2">2</option> </select> I have written a onchange event: $(document).on('change', '[id*=select1]', function () { alert('in change select1'); }); Now suppose I have option 1 selected and I again go and select the same option (option1), then the change...

3 option select set value from database remove onchange

javascript,jquery,mysql,select,onchange
I have 3 select option that load values depending on each other My first select is Continent it has the value of continent on load second select is Country this select will be loaded on change of continent then last select is City this will be loaded on change of...

Vaadin: how to avoid cascade valuechange events between fields

events,recursion,field,vaadin,onchange
I have several fields in a screen, that are partially dependent each on other by validating rules. If user changes one field then I can affect another fields using setValue(). But I am fighting with the problem, valueChange event is fired from setValue() just as from user activity. My example:...

Detection of textarea value chage

javascript,jquery,textarea,onchange
How can I detect, that value in my textareaId has changed when the change was caused by javascript? eg. $("#buttonID").on("click, function(){ $("#textareaID").val("lorem ipsum"); }); $("#textareaID").change(function(){ //not working }); $("#textareaID").bind('input propertychange', function(){ //not working }); ...

angularjs ng-show delay in showing div

angularjs,onchange,ng-show
I am fairly new to Angular. I have a file input <input type="file" id="sampleFile" onchange="angular.element(this).scope().vm.displaySelectedXml()" /> with a div below it: <div ng-hide="!vm.displayXml"> <div> xml file display goes here </div> </div> I got the onchange event handler from here. My controller js has the following function: function displaySelectedXml() { vm.displayXml...

Javascript element name change reverting back to original

javascript,dom,onchange
JavaScript name change of cloned input element "terminal0" isn't saving and/or reverting back to original name after function ends. All other name/id changes work but first element name change reverts back after function completes. Even the first element "terminal0" id change works successfully. I've tested and confirmed name change does...

I cant disable a textbox with checkbox [closed]

javascript,jquery,onchange
I am trying to disable/enable the txtPeriodTo control when the checkbox Change event occurs, but it does not seem to work. I ma using jquery 1.10.4 and both prop and attr method of disabling the textbox does not work. <div id="dvWrapper" class="dvWrapper"> <div id="content"> <table> <tbody> <tr> <td class="tdtDescription">Role:</td> <td>...

Using Jquery to get a dropdown selected and executed

jquery,onchange,option,selected
I am working on a website that has an equipment rental script that uses a dropdown to select categories. http://www.thierryfun.be/indexV2.php The client wants all the categories additionally displayed as buttons. So I am trying to make a click on a button act as if a user selected an option from...

JQuery on(“change”…) method not working in Plunker

jquery,javascript-events,onchange,plunker,plunkr
I created this Plunk to demonstrate and discuss a shopping cart I'm developing that is in action here (while it lasts). In the "real" one, selecting a species fills the Variety drop-down. However, it's not working in the Plunk. In fact, $('#species-select').on('change', ... is never firing. Must be some peculiarity...

Show/hide div on dropdown change problems

javascript,bootstrap,onchange
Sorry total js newbie here I got this JS code from another stackoverflow question $(document).ready(function(){ $('#cart').on('change', function() { if ( this.value == '1') { $(".tea").show(); } else { $(".coffee").hide(); } }); }); It worked for the other guy, but not for me, what am I possibly doing wrong? http://codepen.io/anon/pen/waexVV It...

Is it possible to use onchange with 2 fields? -Odoo 8

python,onchange,odoo-8
I currently have an onchange function that works every time I change the user but I wondering if it is possible that this function can work on 2 fields using an OR? for example: add text to description field if user OR status is changed in the ticket. @api.onchange('responsible_id' or...

Onchange on MVC

javascript,c#,asp.net-mvc-4,razor,onchange
I have this DDL: <div class="editor-field"> @Html.DropDownList("Type", ViewBag.Type as SelectList, "-- Select --") @Html.ValidationMessageFor(model => model.Type) </div> Based on the selected item in this DDL, I want hide an another DDL, in other words, this 2nd DDL will be displayed only if a specific option of the first DDL is...

Setting On Change on id from parameter does not work

jquery,forms,sharepoint,element,onchange
I am using SharePoint 2013, but this is more of a jQuery question/issue. In SharePoint, the form elements are given ID's based off of the name and a key of some sort. I am able to get the ID for the form element that I am trying to add a...

c# changing background color of cell in dataGridView if its value changed

c#,datagrid,onchange
Hello I want to change the background color of a cell in a datagridview if its value changed. I have written the onChange event like this: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name == "Version") { //Change Background } } So how do I change the value of...

How to create a link based on textbox value?

javascript,html,onchange,getelementbyid,onkeyup
I'm trying to change the href of my link based on whats in the textbox with id="serie". As you can see, Firefox tells me that el is null. What did go wrong here? (Upper part is Page, Middle part the debug-console and the lower part is my source code) <html>...

how can i call select box on change while changing select value using jquery?

javascript,jquery,select,onchange
I am having a select box like this <select class="cars" onChange="carName()"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> If am changing dropdown values carName function is calling and working as expected. If suppose I change the value using jQuery like this $('.cars').val('Audi'); I want that carName() function to...

Getting value of toggled select fields in jquery

jquery,onchange,value
Im trying to get the value of a selection based upon a previous on change selection. This is the initial html that shows or hides the next select: <div class="selectOptionCat"> <select class="categoryName1 changeFields" name="option"> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select> </div> Depending on the above selection another selection hides...

Checkbox on change event Javascript

javascript,checkbox,onchange
In my page I have an array of string and in my script I have a function that excludes the strings that contain certain char. I control it through 3 check boxes. I have the functions to do this but my problem is when I check two check boxes one...

How to change the value of an active text input using Javascript?

javascript,html,forms,onchange,active
I am trying to make a form with a date input. However, this input is in date format, and I would like to change the value while the control is still active. Here is the full code : // Javascript code function add_value() { var dataoriginale = document.getElementById("fin_mater").value; if(document.getElementById("fin_mater").value.length =...

onChange not working to show/hide a div

javascript,jquery,html,onchange,selectionchanged
I have a piece of code with HTML & JavaScript. HTML code is <select name="paytype" id="paytype" onchange="insProviderTable()"> <option value="Cash">Cash</option> <option value="Credit" selected>Credit</option> </select> <div id="insuranceDetails" style="display:none"> BULB </div> and JavaScript code is function insProviderTable() { if ($('#paytype').val() == 'Credit') { $('#insuranceDetails').show(1000); } else { $('#insuranceDetails').hide(1000); } }; $(insProviderTable); The issue...