Different ways to disable radio button [closed] - javascript

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
What are the different ways to disable a radio button.
I tried the example below but not working in my system with my environment set up. Its working if I am trying on notepad without environment. Is there any other ways?
var status = 'A';
$("input[type=radio][value=" + status + "]").attr("disabled",true);

I was able to just use disabled in HTML find your UPDATED CODE
<div id="cosProfile">CoS Profile</div>
<span class="icon-information"></span>
<div class="form-field" data-radio id="cosRadioBtns">
<span id="radio_prdefined"><input type="radio" name="CosProfile" data-radio
value="predefined" checked="checked" disabled/></span>
<label id="cos_predefined">Predefined Profile</label>
<span id="radio_custom"><input type="radio" name="CosProfile" data-radio
value="custom" disabled/></span>
<label id="cos_custom">Custom Profile</label>
</div>

Try this:
$("input[type=radio][value=" + status + "]").prop("disabled",true);

Related

Adding more balance via a html input to a javascript variable? [closed]

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
Photo of the website
I have a school project and I need to make a website where I can add more balance to my account. But I can't figure it out.
I would like to make an HTML number input and then that input needs to add up with my existing balance. But I can't make it work
This is the code I have:
<fieldset>
<legend>Opwaarderen</legend>
<input type="number" id="opwaarderen">
<input type="submit" onclick="opwaarderen()">
</fieldset
But how can I make the Javascript function? So that the input will add up to my already existing balance.
This will help
var currentCredit=0;
$("#a").click(()=>
{
alert(currentCredit+=Number($("#opwaarderen").val()));
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<fieldset>
<legend>Opwaarderen</legend>
<input type="number" id="opwaarderen">
<input type="submit" id="a">
</fieldset>

How to remove double quote use onkeyup attr inline? [closed]

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 tried
<input type="text" name="first_name"
onkeyup="value=value.replace(/[\-\'\.\,\/\`\:\~\!\#\#\$\%\^\&\*\(\)\_\+\=\;\|\{\}\[\]\<\>\?]/g,'')">
it works for almost all special chars, but when I add a double-quote filter like
<input type="text" name="first_name" in first
onkeyup="value=value.replace(/[\"\-\'\.\,\/\`\:\~\!\#\#\$\%\^\&\*\(\)\_\+\=\;\|\{\}\[\]\<\>\?]/g,'')">
it seems to not allow to do like that. I want to custom remove the mark I want.
You can put your code in an external function instead of placing it inline. It's just that the " interferes with the html attributes' " and break the code.
document.querySelector(".no-special-chars").addEventListener("keyup", function(){
this.value = this.value.replace(/[\"\-\'\.\,\/\`\:\~\!\#\#\$\%\^\&\*\(\)\_\+\=\;\|\{\}\[\]\<\>\?]/g,'');
});//keyup()
<input class="no-special-chars" type="text" name="first_name" />

auto update form with javascript [closed]

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 8 years ago.
Improve this question
I want the text i type in
<input type="text" name="text1">
will automatically be updated in
<input type="text" name="text2">
by using JavaScript.
Anyone know how to solve it?
Thanks in advance
You can use the onkeyup event and populate the second <input> with the text of the first one, like this:
var inp1 = document.getElementsByName('text1')[0],
inp2 = document.getElementsByName('text2')[0];
inp1.addEventListener('keyup', function(e) {
inp2.value = this.value;
});
<p>Input 1: <input type="text" name="text1" placeholder="write something here..."></p>
<p>Input 2: <input type="text" name="text2" placeholder="ant it will show up here..."></p>
Test it using the "Run code snippet" button.

PHP - Load a div with filtering option when two date fields are filled [closed]

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 8 years ago.
Improve this question
I have developed a leave request page with PHP,Javascript and CSS. I need when user choose the same date on two date fields then will show the div for a option with two radio buttons for halfday leave or fullday leave, please suggest me if any possibilities for this..
We can use jQuery's .val() method to check the date value. If two of them equal, then use .show() to display the extra elements, else use .hide() to not show them.
Start: <input type="date" name="s" id="s" onchange="check()"><br>
End: <input type="date" name="e" id="e" onchange="check()">
<div id="detail" style="display:none">
<select>
<option>Full day</option>
<option>Half day</option>
</select>
</div>
function check() {
if ($('#s').val() == $('#e').val()) {
$('#detail').show();
} else {
$('#detail').hide();
}
}
fiddle

How to replace search box? [closed]

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
So here is my site: http://dll-download.us/
I want it where if someone clicks on "Can't Find a File?", I want it to instead select the search box so they can search for it instead.
Code of search box on my site:
<form method="get" action="/search" id="search">
<input name="q" type="text" size="40" placeholder="Search for a DLL" />
</form>
The easiest way to do this would be to add a click event to the can't find a file link, then use JavaScript to focus the text box.
function setFocus() {
document.getElementById("myTextbox").focus();
}

Categories

Resources