我想将数据从div传输到隐藏输入
// Set the directive
angular
.module('custom.directives')
.directive('customvideo', customvideoDirective);
// Set the directive $injections
customvideoDirective.$inject = ['$Scope'];
function customvideoDirective($Scope)
{
return {
compile: compile,
restrict: 'A',
$Scope: {
isvalid: '=?'
}
};
function compile() {
console.log($Scope.isvalid); //this is undefined
}
}
})();
我的解决,但它不起作用:
<div id="timing"><table>...i need date from here...</table></div>
&#13;
答案 0 :(得分:1)
在这里,从html(...)更改为val(...)和html()更改为text():)
<script>
$(document).ready(function(){
$('#textarea').keyup(function() {
$('#dateD').val($('#div.timing').text());
});
});
</script>
<input type="hidden" id="dateD" value="" name="time1">
答案 1 :(得分:0)
$('#timing').text()
允许您这样做。