Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Here is the code with ng-model and updating it from controller
Below is my dom element.
<div ng-app>
<div ng-controller="AppCtrl">
<input type="text" ng-model="guages" value="{{guages}}"/>
</div>
</div>
This is my controller, what is wrong in this.
function AppCtrl($scope){
console.log($scope.guages);
$scope.gauges=5;
}
You have guages v.s gauges in the sample.
$scope.gauges=5;
should be
$scope.guages=5
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 months ago.
Improve this question
Please advise why this code doesn't work. The ID of the form should appear in input field as value.
$("button").click(function() {
$("form").attr(id, "message");
$("input").val($("form").attr('id'));
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
<input type="text">
</form>
<button>Check</button>
You need to use quotes for the id
$("form").attr("id", "message");
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I use jquery to put html dynamically but it is not working...
Here is what I have tried
$("#root").innerHtml("<h1>Hello</h1>")
You should not use innerHtml instead use html()
You can do as below
$("#root").html("<div>Hello</div>")
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
Using jQuery
console.log($(this).html());
console.log($(this).data('section'));
yields
Include Children?
and
undefined
and I'm not sure what I'm doing incorrectly. The <a> here is inside an un-ordered list <li> tag, but I'm not sure why that should matter. Thanks in advance!
As you said it is <li> enclosing the <a>
then it should be:-
console.log($('li a').html());
console.log($('li a').data('section'));
Example:-
console.log($('li a').html());
console.log($('li a').data('section'));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<li>Include Children?</li>
Note:- you can do $(this).find('a').data('section'); also based on your HTML structure.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm trying to select a class inside div.
my code:
<div id="cool" style="width: 80%;height: 80%;margin: auto;">
cool
</div>
Selector:
$('#cool .redirect').attr('href', google.com);
it does not work. Please suggest.
I'm a beginner and just started to learn jquery!
Your code works for me once I correct your attempt to use google.com (that is, the value of the field named com in the nonexistent variable google). Put quotation marks around the string and it works fine.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I want to change a piece of text with the click of a button, this doesn't work. Any ideas?
<div>
This text should stay, <span id="x">This text should change.</span>
</div>
<button type="button" onclick='change()'>Change</button>
<script type="javascript/text">
function change() {
document.getElementById('x').innerHTML='The text has changed.';
}
</script>
What did I do wrong?
Your type attribute is wrong. You don't really need it at all. If you do want to include it, change it to text/javascript.