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 5 years ago.
Improve this question
I am working in MVC C#. I have a table with Enum values. I got 2 conditions in Enum as On and Off. I want my text box to be Enabled during On and Disabled during Off. How to do this ? kindly help.
My text box as follows:
<div ><p class="form_text1">Start</p> <input type="text" id="EditStart" name="EditStart" class="form-control">
</div>
If you want a bit more of a generic approach, you can do this through C# instead of JavaScript. However, I am unsure how you are getting this enum so my answer might not work. Hope this helps.
public static MvcHtmlString EnumTextBox(this HtmlHelper<TModel> htmlHelper,
YourEnum enum)
{
object attributes = null;
if(enum == YourEnum.Off)
{
attributes = new
{
disabled = "disabled"
};
}
return htmlHelper.TextBox("YourTextBoxName", null, attributes);
}
Note: I did not test this, just wrote it out from head.
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 2 years ago.
Improve this question
When I play a sound with js, I just want the sound coming from the right. how can I do that
Yes. Check out StereoPannerNode from the Web Audio API.
The pan property takes a unitless value between -1 (full left pan) and
1 (full right pan). This interface was introduced as a much simpler
way to apply a simple panning effect than having to use a full
PannerNode.
Also see this example: https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API#Adding_stereo_panning_to_our_app:
const pannerOptions = { pan: 0 };
const panner = new StereoPannerNode(audioContext, pannerOptions);
<input type="range" id="panner" min="-1" max="1" value="0" step="0.01">
const pannerControl = document.querySelector('#panner');
pannerControl.addEventListener('input', function() {
panner.pan.value = this.value;
}, false);
track.connect(gainNode).connect(panner).connect(audioContext.destination);
(Note: this isn't specific to Vue)
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 2 years ago.
Improve this question
From the screenshot below, two questions as newbie of javascript developer.
I want to directly get the value of the second td from $('#cart-subtotal-order.total.subtotal td') in javascript code. That is the first question. The second question is how to get the value of $('.amount grand-total'). Is it right to use val() for that like this $('.amount grand-total').val() or should I use text() for the regular text value for that?
HTML Body elements source screenshot
if you wat to get second td from tr:
var subtotal = $('#cart-subtotal-order.total.subtotal').find("td:eq(1)").text();
then if you want to get grand total is like:
var grand_total = $('#totalRow .grand-total').text();
For Getting Second row text, you can use the following code
var seondRow = $("table>#cart-subtotal-order.total.subtotal> td:nth-child(2)").text();
For Getting the grand total
var grandTotal = $('#totalRow .grand-total').text();
or
var grandTotal = $('#totalRow .grand-total').value();
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 5 years ago.
Improve this question
I have a small project where i created text fields based on user input.
$('#arraySizeButton').click(function() {
var arraySize = $("#arraySize").val();
if(arraySize=='') {
alert("Enter Some Text In Input Field");
}else{
var count = arraySize;
var html = [];
while(count--) {
html.push("\<input type='text' id='inputTextField", count, "'>");
}
$('#inputTextFieldsarea').append(html.join(''));
}
});
I want to create a dynamic program based on above code and retrieve data from textfields to an array. Appreciate your help.
Did you mean this?
html.push("<input type='text' id='inputTextField"+count+"'/>");
What you should do is add a [] to the name of the input, to let the html form know that this is an array.
You should do something like that:
html.push("\<input name='field[]' type='text' id='inputTextField", count, "'>");
And using php to get the content of all the POSTed fields you could simply check
$_POST['field']
which is an array.
EDIT: IF you want to do this using jquery as you stated in your comment, then you could do it like that:
$('[id^="inputTextField"]').each(function() {
alert($(this).val());
});
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 7 years ago.
Improve this question
These are my checkboxes:
<input type="checkbox" name="cb1" onclick="check(this)">Batas Wilayah</input><br>
<input type="checkbox" name="cb2" onclick="check(this)">Lokasi Masjid</input><br>
This is my PHP code:
<?php
function check() {
if ($('cb1').is(":checked")) {
$.getScript("batas.php");
} elseif ($('cb2').is(":checked")) {
$.getScript("daftar.php");
}
}
When cb1 or cb2 are checked, I want to immediately call a server-side PHP script with the form data. Can anyone point me in the right direction?
jQuery.getScript is specifically for loading javascript. In theory it should still work fine but using a AJAX jQuery.get request is worth a shot.
$.get("batas.php", function( data ) {
alert(data);
});
In the above code data is the data returned from the php script.
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 am new in this world...so please help..I want idea from u people...I have 4 dropdown list ..and I wanted to populate select box on selecting another selectbox2 .... using database values....so how should I proceed ..i need your help...and i have already created the database for that...and I am good with database....so please help me..forward me some link also..I have short span of time..within that i have to complete..please help.
In Spring 3.0 you can populate values in the dropdown as follows:
#ModelAttribute("webFrameworkList")
public List<String> populateWebFrameworkList() {
//Data referencing for web framework checkboxes
List<String> webFrameworkList = new ArrayList<String>();
webFrameworkList.add("Spring MVC");
webFrameworkList.add("Struts 1");
webFrameworkList.add("Struts 2");
webFrameworkList.add("JSF");
webFrameworkList.add("Apache Wicket");
return webFrameworkList;
}
In JSP
<form:select path="favFramework">
<form:options items="webFrameworkList"/>
</form:select>
Now you can modify the logic as per your requirement that you want.