Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
The value of universal_leadid is populated on every refresh and it come from a script related to a 3rd party Lead verification service (leadid.com). The objective for me is to post the other6 field value the same as the value assosiated with universal_leadid field.
HTML:
<input type="hidden" name="Other6" value="">
<input type="hidden" name="universal_leadid" value="KFLS00-D254-DD521-GF52-GHT554125" id="leadid_token">
Lead Id value is populated by lead id but I can't get value of the Other6 field.
This is what I have tried and the result is blank or nothing:
$( document ).ready(function() {
$('[name=Other6]').val($('[name=universal_leadid]').val());
//alert(universal_leadid);
//console.log($('[name=universal_leadid]'));
//console.log($('[name=universal_leadid]').val());
//console.log($('[name=Other6]').val());
$('#salutation').attr('checked',false);
//var myValue = $( "#leadid_token" ).val();
//document.getElementById('leadid_token');
//var x = document.getElementById("leadid_token").value;
//alert(x); // Showing Empty alert box
});
The result I want, is that every value populated on universal_leadid need to go to Other6 field
Your both the input fields are hidden
Please use
<input type="text" name="Other6" value="">
<input type="text" name="universal_leadid" value="KFLS00-D254-DD521-GF52-GHT554125" id="leadid_token">
Working Fiddle
Try this :
var token = $("#leadid_token").val();
$("input[name=Other6]").val(token);
console.log($("input[name=Other6]").val());
http://jsfiddle.net/8rw9cep6/
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm looking to make a Google search bar for a website I am creating. I would like to search Google for the text entered in an <input> tag. Any help would be greatly appreciated.
Try something like this
<script>
function googleSearch()
{
var text=document.getElementById("search").value;
var cleanQuery = text.replace(" ","+",text);
var url='http://www.google.com/search?q='+cleanQuery;
window.location.href=url;
}
</script>
<input type="text" id="search" />
<button onclick="googleSearch();">Search</button>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I understand how to use input into html to call javascript defined in the same directory as the html ex:
<input type="button" value="Submit" onclick="someFunc(500)" >
so if the button is clicked the java script will run someFunc(500), is there a way to take text input, and when a button is pressed use this input as a parameter value for the java script? I know this won't work and I'm not even defining a button, but something like
<input type="text" id= "example" onclick="someFunc(this.value)">
where example is the data that was put into the input text field?
What about using a listener?
var example = document.getElementById("example");
example.onclick = function(){
someFunc(example.value);
}
You can do this with jQuery: See this jsfiddle
HTML:
<input type="text" id="example" value="12345">
JavaScript:
$('#example').on('click',function() {
console.log($(this).val()); // 12345
});
The HTML 5 Recommended way, is to use data-* attributes. Like this:
HTML:
<div id="example2" data-product-id="my-product-1"></div>
<button id="getProductId">Get Product Id</button>
JavaScript:
$('#getProductId').on('click',function() {
console.log($('#example2').attr('data-product-id')); // my-product-1
});
<script type="application/javascript">
function someFunc() {
var value = document.getElementById('example').value;
// do something with value here
return false;
}
</script>
<input type="text" id="example">
<input type="button" value="Submit" onclick="someFunc()" >
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
http://jsfiddle.net/t32h0gj4/4/
how to show variable inside input box<b id="smsCount"></b> SMS (<b id="smsLength"></b>) Characters left
<br />
<input type= "text" id= "smsCount" ></input>
<textarea id="smsText" style="width:400px;height:200px"></textarea>
Please help me
Fixed: http://jsfiddle.net/t32h0gj4/5/
Changes:
HTML: change id="smsCount" to class="smsCount" (id's need to be unique)
JavaScript: change the selector to .smsCount and further below also call the jQuery .val() function to set the input box.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i have two div's and i want to select first upper div value then lower div value. and pass both the values to next page.
here's my code:
<div id="upper">
Link
</div>
<div id="lower">
Link 1
</div>
if upper value is not selected then it should not go to the next page and when both values are selected then it should go on to next page.
what are the possible solutions.
Any help would be appreciated.
html
<span class="span_to_remember" data-my-data="myData1">
data1
</span>
<span class="span_to_remember" data-my-data="myData2">
data2
</span>
<span class="span_to_remember" data-my-data="myData3">
data3
</span>
<span class="span_to_remember" data-my-data="myData4">
data4
</span>
js(jquery)
$(document).ready(function(){
$(".span_to_remember").click(function() {
var spanData = $(this).data("my-data");
// also you can grab html with
// var spanData = $(this).html();
localStorage.setItem('param1', spanData);
});
});
after you write something on first page, you can read it on other page with
localStorage.getItem('param1');
info will be available for user on every page, even if he close browser, and return to website later
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a disabled field that I want to edit with the below script
<html>
<select id="country"onchange="changeCountryCode()">
<input type="text" disabled id="cc">
<script>
function changeCountryCode()
{
var temp = $('country').val();
$('cc').val(temp);
}
</script>
</html>
It's not working for me.
What you have almost works but you are missing the # in your selectors. The # sign tells jQuery to use the ID attribute when looking up the element desired.
Should be:
var temp = $('#country').val();
$('#cc').val(temp);